我最近将Crystal Report从未知版本更新为v13。此报告使用6“x4”标签打印到Zebra TLP2844标签打印机(6英寸长,4英寸宽,因为它们来自标签打印机)。在更新之前,一切正常。之后,我无法在横向上打印标签。无论我使用什么设置,我总是得到肖像。
以下是我在Visual Studio 2010中的设置:
我的打印代码:
public void print_label(CTapeID myTape)
{
_myTape = myTape;
LabelReport crystalPrint; // name of report class
CPrinterObject po;
CPrinterInfo pi;
String printerType = "LABEL_4060";
LabelInfo cpd; // name of dataset class for the report
try
{
crystalPrint = new LabelReport();
crystalPrint.ReportOptions.EnableSaveDataWithReport = false;
po = new CPrinterObject();
pi = po.FindPrinter(printerType);
if(pi != null)
{
crystalPrint.PrintOptions.PrinterName = pi.PrinterName;
}
crystalPrint.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
cpd = GetLabelData();
crystalPrint.SetDataSource((DataSet)cpd);
crystalPrint.PrintToPrinter(1, false, 1, 0);
crystalPrint.Close();
crystalPrint.Dispose();
}
catch(Exception ex)
{
ex.Source = MethodBase.GetCurrentMethod().Name + "(): " + ex.Source;
throw ex;
}
}
CPrinterObject
和CPrinterInfo
是获取打印机名称和属性的内部类。
答案 0 :(得分:0)
我花了三天半的时间追查这个问题并阅读了数以万计的老问题“我也遇到了这个问题。你有没有解决过这个问题?”帖子。我终于破解了它。
无论您选择哪种代码设置和纸张尺寸,Crystal都会讨厌Zebra,并会随意决定肖像/风景,因为它比您更了解。
为我解决的是: