使用 CanGrow=True 时 CrystalReports excel 字段被截断
我正在 VS2005 中的 CrystalReports 中处理 Excel 报告。我在“详细信息”部分中有一个字段,最多可以包含 255 个字符的文本,并且我希望 Excel 中的行高度能够展开,以便在生成报告时最初可以看到整个文本。
我在字段的属性中设置了 CanGrow=True ,并且该字段似乎确实在增长;该字段只有一行(高度 = 159),但许多行显示多行换行文本。有些行间歇性地截掉了最后一行文本的下半部分;用户必须稍微展开该行才能看到它。似乎没有特定的字段长度导致这种情况 - 在一种情况下,输出中总共有四行,而在另一种情况下,它只有三行。
谁能建议这可能是什么原因,或者我该如何解决它?
预先感谢你们可以提供的任何帮助。
[编辑:我不再从事这个项目,所以我从来不知道这个设置发生了什么。它很可能没有被修复,因为这不是一个关键问题。]
I am working on an excel report in CrystalReports, in VS2005. 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.
I set CanGrow=True in the field's properties, and the field does seem to grow; the field is only one line (Height=159), but many of the rows display multiple, wrapped lines of text. 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.]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我过去提出的解决此问题的一种方法是拥有两个单独的报告。一个用于显示并导出到 pdf 或 rtf,另一个用于导出到 Excel 的报告。
我知道一般来说这不是一个好方法,因为导出中的数据可能与显示报告不同,但如果小心的话,效果会很好。
我遇到过这样的情况:客户需要以特定格式在报告上打印数据,但有很多数据实际上能够容纳在页面上。我们制定了一个解决方案,我运行适合大多数数据的报告的“显示版本”,但客户端所需的其余数据仅添加到报告的“Excel 版本”中。
为此,我只需像平常一样将“显示报告”加载到报告查看器,但是当您导出报告时,我将使用与“显示报告”相同的参数加载“excel 报告”,并调用代码将数据导出到 Excel。
通过使用这种方法,“显示报告”可以以任何必要的方式格式化,而不必担心弄乱导出到 Excel。然后,Excel 报告字段的大小可以小于显示报告所需的大小,因为无论字段大小如何,数据都应该导出。这样做可以让您在 Excel 导出报告中容纳更多数据。
由于两个报告都使用相同的数据源,如果您进行更改,您将遇到问题,您必须记住验证每个报告上的数据库以查看新的数据库更改,但此方法允许您包含更多数据并在不同的数据源中包含更多数据。格式与报告的显示版本不同。
希望这有帮助。
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.
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.
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.
By using this method the "display report" can be formatted any way necessary without having to worry about messing up the export to 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. Doing this allows you to fit more data on the Excel export report.
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.
虽然这不是 Crystal 的解决方案(我不知道有哪一个),但作为 GrapeCity-Data Dynamics 报告团队的一员,我们十年来一直致力于将自由格式报告转化为 Excel 电子表格来解决类似问题。在我们的数据动态报告产品中,我们提出了一种全新的方法来解决将报告导出到 Excel 的问题。
我们允许您为报告输出创建模板。该模板是一个基本的 Excel 文件,其中包含报表中各种文本框(或其他控件)和区域(表格、列表等)的占位符。您可以在 Excel 中打开此模板并修改单元格和行的属性。在您描述的场景中,您可以从数据动态报告导出“模板”,然后修改模板中包含您正在处理的文本框占位符的行的自动调整大小属性。
当您下次将报告导出为 Excel 时,只需为 Data Dynamics Reports 指定模板(可以通过编程方式完成,并且对最终用户透明),Data Dynamics Reports 将遵循您在模板中指定的所有设置。
这很难解释,因此我们的网站上有一个约 2 分钟的截屏视频,展示了此功能:
http://www.datadynamics.com/Products/DDRPT/ScreencastViewer。 aspx?ID=XLS01
有关该产品的更多信息以及免费试用版下载,请访问:http:// /www.datadynamics.com/DataDynamicsReports
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. In our Data Dynamics Reports product we came up with a completely new way of solving the problem of exporting reports to 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. You can open this template inside of excel and modify the properties of the cells and rows. 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.
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.
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
For more information about the product and for a free trial download visit: http://www.datadynamics.com/DataDynamicsReports