开发者

crystal report export to excel in 1 horizontal line of all data rows

开发者 https://www.devze.com 2023-03-26 14:46 出处:网络
I have a report which hasONLY \"Report header\" section and NO \"Detail section\", NO any other sections.

I have a report which has ONLY "Report header" section and NO "Detail section", NO any other sections.

It should be in that format cause I have a query which returns 1 row with many columns, like this:

val1, val2, val3, val4, val5, val6

And I want it to display in crystal report and in excel file like this:

constant Label1 val1

constant Label2 val2

constant Label3 val3

constant Label4 val4

constant Label5 val5

constant Label6 val6

It displays correctly in crystal report but when export to excel (data only), it takes all of these into 1 horizontal line with multiple columns: constant Label 1 开发者_高级运维val1 constant Label 2 val2 constant Label 3 val3.....

How to solve this? Thanks so much!!!


The reason the export is throwing all the values onto one line in Excel is because there are no delimiters that excel can understand. Just putting them one value above the other in the same section in the report isn't enough. There are a few things you can try.

  1. If you only have 6 rows, just break up the Report Header into 6 subsections and into each subsection put a constant-Label-value. CR will probably export these with some sort of delimiter that will carry over to Excel.

  2. If that doesn't work, put one formula in the Report Header that builds up one long string of values that you want using tabs, newlines, whatever. For example, totext(constant) + chr(9) + label + chr(10) + totext(constant2) + ... Or however you want the data formatted. The downside to this method is that you'll lose the format for each cell (rather, all cells will be string types).

0

精彩评论

暂无评论...
验证码 换一张
取 消