简体   繁体   English

水晶报表导出到所有数据行的1条水平线上的excel

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

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: 它应该是这种格式,因为我有一个查询,该查询返回包含多列的1行,如下所示:

val1, val2, val3, val4, val5, val6 val1,val2,val3,val4,val5,val6

And I want it to display in crystal report and in excel file like this: 我希望它显示在水晶报表和excel文件中,如下所示:

constant Label1 val1 常数Label1 val1

constant Label2 val2 常数Label2 val2

constant Label3 val3 常数Label3 val3

constant Label4 val4 常数Label4 val4

constant Label5 val5 常数Label5 val5

constant Label6 val6 常数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..... 它可以在Crystal报表中正确显示,但是在导出到excel(仅数据)时,会将所有这些转换为多列的1条水平线:常数Label 1 val1常数Label 2 val2常数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. 导出将所有值都放在Excel中的一行上的原因是因为没有excel可以理解的定界符。 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. 如果只有6行,只需将“报告标题”分成6个小节,并在每个小节中放置一个常量标签值。 CR will probably export these with some sort of delimiter that will carry over to Excel. CR可能会使用某种定界符将其导出,这些定界符会保留到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. 例如, totext(constant) + chr(9) + label + chr(10) + totext(constant2) + ...或者,但是您想要格式化数据。 The downside to this method is that you'll lose the format for each cell (rather, all cells will be string types). 这种方法的缺点是,您将丢失每个单元格的格式(相反,所有单元格都是字符串类型)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM