在同一张纸上打印多份副本。水晶报告。 。网
使用 Crystal Reports 和 .NET 我有一个要求,需要在每张纸上打印两份相同的报告。我可以使用两个子报告将 CanGrow 设置为 false 来完成此操作,但这不起作用,因为我的报告可能不止一页,而 CanGrow 只会裁剪报告的其余部分。将 CanGrow 设置为 false 将导致两个报告重叠,或者依次打印。我还尝试制作双重报告,“页眉 - 详细信息 - 页脚”和“页眉 - 详细信息 - 页脚”(重复相同的信息),但水晶报告不允许我有多个详细信息部分(它们之间有页眉页脚部分)。
我可以使用 MsWord 重现我想要的内容,在打印设置中将打印机设置“打印多份”更改为 2,然后键入并将页面范围设置为“页面:1,1,2,2,3,3 ,4,4...”但是 Crystal Reports 的打印 API 不允许我调整这些设置,甚至不允许从 .NET 打印 API,所以我想使用 Native Win32 API,但即使我能够做到对于 Win32 我不知道如何告诉 Crystal Reports 使用我的打印功能。
我对水晶报告还很陌生,所以也许有一个简单的解决方案。如果有人可以帮忙的话。
Using Crystal Reports and .NET I have a requeriment where I need to print 2 copies of the same report on each sheet. I´m able to do this using two subreports setting CanGrow to false, but this doesnt work cause my report may have more than one page, and CanGrow will just crop the rest of the report. Setting CanGrow to false will cause the two reports to overlap, or print one after another. I also tried making a double report, Header - details - footer, and Header - details - footer again (repeating the same information), but crystal reports doesnt allow me to have multiple details sections(with header footer sections between them).
I´m able to reproduce what I want using MsWord, in the printing settings changing the printer setting "print multiple copies" to 2, and then typing and setting Page range to "Page: 1,1,2,2,3,3,4,4... " but the printing API from Crystal Reports won´t let me adjust these settings, not even printing APIs from .NET, so I though of using Native Win32 API, but even if I´m able to do this with Win32 I don´t know how to tell Crystal Reports to use my printing functions.
I´m pretty new to crystal reports so maybe there is a simple solution for this. If someone can help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您需要保持子报表的原样,并包含要复制的报表详细信息,但您不能将子报表的两个实例放在同一部分中并期望它们正确地间隔开。您需要在主报告中为第二个子报告使用第二个详细信息部分,然后它们不应相互覆盖。详细信息部分都需要设置 cangrow = true 。
好的,您需要的只是 2 个报告,其中一份按照客户希望的方式(页眉、页脚等)用作子报告,另一份没有任何页眉或页脚,但有 2 个带有 cangrow=true 的详细信息部分和一个实例每个详细信息部分中的子报告。我不确定为什么您想要在 5 条记录后创建一个新页面,但请尝试将其取出并查看是否可以在主报告中打印相同的子报告两次。
I think you'll need to keep your subreport the way you have it, with the report details you want copied, but you can't place the two instances of the subreport in the same section and expect them to space themselves correctly. You'll need to use a second detail section in your main report for your second subreport, then they shouldn't overwrite each other. The detail sections both need cangrow = true set.
OK, all you should need is 2 reports, one formatted the way the customer wants (headers, footers, etc.) to use as the subreport, and one without any headers or footers, but 2 detail sections with cangrow=true and an instance of the subreport in each detail section. I'm not sure why you want a new page after 5 records, but try taking that out and see if you can print the same subreport twice within a main report.
我想我已经解决了。我创建了两个报告:原始报告和复制报告,并抑制了除详细信息部分之外的所有部分,并使用此处提到的解决方法添加了一个组:
http://www.c-sharpcorner.com/UploadFile/mahesh/SubReportPH10062006160749PM/SubReportPH.aspx
以便能够使用在每个页面上重复的标题。
我将所有标题信息放在组标题上,将报告页脚信息放在组页脚上(无法使用其他部分,因为它们不尊重我需要的间距,这是此解决方法的主要缺点),并限制详细信息部分添加了一些仅占页面一半的记录。在复制版本中,我在页眉中添加了一个等于页面一半的空格。然后,我创建了一份报告,该报告将包含两个子报告,其中所有部分均被抑制,并且只有一个详细信息部分,并将两个子报告一个一个地添加到另一个子报告之上。这将在页面底部打印第二个子报告,并在其标题中留出空间,以便第一个子报告在顶部打印,我现在仍然不知道如何在每一页上重复基础部分,但我想我不知道需要它。
I think I kind of solved it. I created two reports: Orignal, and Copy, and supressed all sections except details section and added a group using the workaround mentioned here:
http://www.c-sharpcorner.com/UploadFile/mahesh/SubReportPH10062006160749PM/SubReportPH.aspx
to be able to use headers that would repeat on every page.
I put all my header information on the group header, and the report footer information on the group footer(other sections can´t be used since they wont respect the spacing I need, that´s the major drawback of this workaround), and limit the details section to a number of records that will fill only half of the page. In the copy version I added a space in the header equal to half of the page. Then I created the report that will hold both subreports with all sections supressed and only one detail section, and added both subreports there one on top of another. This will print the second subreport at the bottom of the page leaving the space from its header for the first subreport to print on top, I still don´t know how to repeat footing section on every page by now but I think I don´t need it.