gpt4 book ai didi

c# - 如何通过代码设置 Crystal 报表的准确长度?

转载 作者:太空宇宙 更新时间:2023-11-03 13:56:31 24 4
gpt4 key购买 nike

我有一份用 Crystal Rerports 12x8.5 英寸设计的报告。我将我的 OKI 3320 打印机驱动程序设置为这个尺寸。现在,当我使用 C# 代码打印报告时,页面长度比撕下位置短了半英寸。我必须卷起纸才能将其撕下。是否可以通过代码更改任何设置以准确到达撕下位置?

          ReportDocument oReportDocument = new ReportDocument();
oReportDocument.Load(reportPath + "\\OutDkt.rpt");

List<TblOutDocket> lstDockets = new List<TblOutDocket>();
lstDockets.Add(oTblOutDocket);
oReportDocument.SetDataSource(lstDockets);

oReportDocument.PrintOptions.PrinterName = LocalPrintServer.GetDefaultPrintQueue().FullName;
oReportDocument.PrintToPrinter(1, false, 0, 0);

最佳答案

当您使用自定义页面大小时,您似乎需要专门指定页面设置。根据这个link您可以通过设置 PageSettings 命名空间来实现这一点。

When you want to use a papersize with an id greater then 118 (Windowscoded papersize) you must supply the id of your papersize toPrintOptions.PaperSource. Obviuosly you need to cast it atCrystalDecisions.Shared.PaperSource I do this:

ReportDocument.PrintOptions.PaperSource =(CrystalDecisions.Shared.PaperSource)m_PageSettings.PaperSource.RawKind;

ReportDocument.PrintOptions.PaperSize =(CrystalDecisions.Shared.PaperSize)m_PageSettings.PaperSize.RawKind;

Where m_PageSettings is my System.Drawing.PageSettings that specifythe right PaperSize

关于c# - 如何通过代码设置 Crystal 报表的准确长度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12005047/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com