简体   繁体   English

使用CanGrow = True时,CrystalReports Excel字段被切断

[英]CrystalReports excel field cut off when using CanGrow=True

I am working on an excel report in CrystalReports, in VS2005. 我正在VS2005中的CrystalReports中处理Excel报告。 I have a field in the Details section which can have up to 255 characters of text, and I want the height of the row in excel to expand so that the entire text can be seen initially when the report is generated. 我在“详细信息”部分中有一个字段,该字段最多可以包含255个字符的文本,并且我希望扩展excel中的行的高度,以便在生成报告时可以在最初看到整个文本。

I set CanGrow=True in the field's properties, and the field does seem to grow; 我在字段的属性中设置CanGrow = True,该字段似乎确实在增长; the field is only one line (Height=159), but many of the rows display multiple, wrapped lines of text. 该字段只有一行(高度= 159),但是许多行显示多行换行的文本。 Some rows intermittently have the bottem half of the last line of text cut off; 某些行断断续续地截断了最后一行文本的底部; the user has to expand the row a little bit to see it. 用户必须将行扩大一点才能看到它。 There doesn't seem to be a particular field length that causes this - in one case, it has four lines total in the output, and in another case, it has only three. 似乎没有特定的字段长度会导致这种情况-在一种情况下,输出总共有四行,而在另一种情况下,只有三行。

Can anyone suggest what might be the cause of this, or how I could work around it? 谁能建议这是什么原因,或者我如何解决呢?

Thanks in advance for any help you guys can offer. 在此先感谢您提供的任何帮助。

[Edit: I am no longer working on this project, so I never found out what became of this setting. [编辑:我不再从事这个项目,所以我从来没有发现这个设置的结果。 Most likely it wasn't fixed, since it's not a critical issue.] 由于它不是关键问题,因此很可能尚未解决。]

One solution to this issue that I've come up with in the past is to have two separate reports. 我过去提出的解决此问题的一种方法是拥有两个单独的报告。 One for display and exporting to pdfor rtf and another report for exporting to Excel. 一个用于显示并导出到pdf或rtf,另一个用于导出到Excel的报告。

I know in general this is not a good approach because there is the possibility for data to be different in the export than the display report, but if careful it works well. 我通常知道这不是一个好方法,因为导出中的数据可能与显示报告中的数据不同,但是如果小心的话,它会很好地工作。

I have a situation where a client needs data printed in a specific format on a report, but there is way to much data to physically be able to fit on a page. 我遇到一种情况,客户需要在报表上以特定格式打印数据,但是有很多方法可以使大量数据实际适合页面。 We worked out a solution that I run a "display version" of the report that fits most of the data, but the rest of the data necessary for there client is added only to the "Excel version" of the report. 我们制定了一个解决方案,使我运行适合大多数数据的报表“显示版本”,但是将客户端所需的其余数据仅添加到报表的“ Excel版本”。

To do this I simply load the "display report" to the report viewer as you normally would, but when you go to export the report I load the "excel report" with the same parameters as the "display report" and call the code to export the data to Excel. 为此,我只需像往常一样简单地将“显示报告”加载到报告查看器中,但是当您导出报告时,我使用与“显示报告”相同的参数加载“ excel报告”并调用代码以将数据导出到Excel。

By using this method the "display report" can be formatted any way necessary without having to worry about messing up the export to excel. 通过使用这种方法,“显示报告”可以采用任何必要的格式设置,而不必担心将输出弄乱到excel。 The excel report fields can then be made a smaller size than required by the display report because the data should export even regardless of the size of the field. 然后,可以使excel报告字段的大小小于显示报告所需的大小,因为即使字段大小,数据也应导出。 Doing this allows you to fit more data on the Excel export report. 这样可以使更多数据适合Excel导出报告。

Since both reports use the same datasource you will have an issue if you make a change that you have to remember to go verify the database on each report to see the new database changes, but this method allows you to include more data and in a different format than the display version of the report. 由于两个报表都使用相同的数据源,因此如果进行更改,您将不得不记住在每个报表上验证数据库以查看新的数据库更改,但是这种方法使您可以包含更多的数据,并且可以将其包含在其他数据中格式比报表的显示版本大。

Hope this helps. 希望这可以帮助。

While not a solution for Crystal (I don't know of one), as part of the reporting team at GrapeCity-Data Dynamics, we've worked with similar issues taking free-form reports to excel spreadsheets for a decade. 虽然不是Crystal的解决方案(我不知道一个),但作为GrapeCity-Data Dynamics的报告团队的一部分,我们十年来一直致力于解决类似问题,采用自由格式报告来使电子表格优于Excel。 In our Data Dynamics Reports product we came up with a completely new way of solving the problem of exporting reports to excel. 在我们的Data Dynamics报表产品中,我们提出了一种全新的方式来解决将报表导出到excel的问题。

We allow you to create a template for the report output. 我们允许您为报告输出创建模板。 The template is a basic excel file with place holders for the various textboxes (or other controls) and regions (tables, lists, etc.) in the report. 模板是一个基本的excel文件,带有占位符,用于报表中的各种文本框(或其他控件)和区域(表,列表等)。 You can open this template inside of excel and modify the properties of the cells and rows. 您可以在excel中打开此模板,然后修改单元格和行的属性。 In the scenario you describe, you can export a "template" from Data Dynamics Reports and then modify the autosize property of the row in the template containing the placeholder for the textbox you're struggling with. 在您描述的场景中,您可以从Data Dynamics报表中导出一个“模板”,然后修改模板中包含您所苦苦挣扎的文本框的占位符的行的autosize属性。

When you export the report to excel next time, just specify the template to Data Dynamics Reports (which can be done programmatically and transparently to the end user) and Data Dynamics Reports will honor all settings you specified in the template. 下次将报表导出到excel时,只需将模板指定为Data Dynamics报表(可以以编程方式对最终用户透明地进行),并且Data Dynamics报表将接受您在模板中指定的所有设置。

This is hard to explain so there is a ~2 minute screencast that shows this feature at our website in the following location: http://www.datadynamics.com/Products/DDRPT/ScreencastViewer.aspx?ID=XLS01 这很难解释,因此在我们的网站上的以下位置,大约有2分钟的屏幕录像显示了此功能: http ://www.datadynamics.com/Products/DDRPT/ScreencastViewer.aspx?ID=XLS01

For more information about the product and for a free trial download visit: http://www.datadynamics.com/DataDynamicsReports 有关该产品的更多信息以及免费试用版下载,请访问: http : //www.datadynamics.com/DataDynamicsReports

Scott Willeke
GrapeCity - Data Dynamics

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

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