首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用.NET在64位服务器(Win2k8)上将报表打印到选定的打印机上?

如何使用.NET在64位服务器(Win2k8)上将报表打印到选定的打印机上?
EN

Stack Overflow用户
提问于 2014-07-24 18:59:25
回答 1查看 9.1K关注 0票数 1

我们有一个基于.NET远程处理的windows应用程序。这是一个使用.NET Framework2.0构建的32位应用程序。我们正在使用用于.NET框架4(32位版本13.0.3)的SAP运行时引擎来实现报表功能。还有一种打印功能,在批处理运行期间,用户将相应的报表打印到选定的打印机。整个设置在Windows服务器2003服务器上运行良好。现在我们试图将应用程序迁移到Windows server 2008,打印工作不正常。它总是将报表打印到Windows服务器2008机器上的默认打印机,而不是将其打印到选定的打印机。

CrystalDecisions.CrystalReports.Engine、CrystalDecisions.ReportSource和CrystalDecisions.Shared是引用自

C:\Program \sap businessobjects \ .net框架的水晶报表4.0\公用\sap业务对象企业xi 4.0\win32_x86

我们将应用程序转换为64位版本。在Windows 2008上,尽管我们安装了SAP报告.NET Framework4(64位版本13.0.3)的运行时引擎,但打印工作不正常(总是将打印转到默认打印机)。在64位安装文件夹中也找不到上面的DLL。

C:\Program \sap businessobjects \ .net框架的水晶报表4.0\公用\sap业务对象企业xi 4.0\win64_x64

我找不到代码的任何问题,我认为这肯定是一个兼容性问题。我被这个问题困扰了一个多月。请帮帮忙。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-05 22:44:25

我们发现了问题和解决办法。它与密码有关。

代码语言:javascript
复制
string printPath = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string rptFileName=@"\sample.rpt";
string PrinterName=Console.ReadLine();

ReportDocument reportDocument = new ReportDocument();
reportDocument.Load(printPath + rptFileName);
reportDocument.PrintOptions.PrinterName = PrinterName;           
reportDocument.PrintToPrinter(1, true, 0, 0);

即使指定了正确的打印机名称,reportDocument.PrintOptions.PrinterName始终是空的。代码已被更改如下,在Windows 2008 R2上使用现有的set安装(SAP报告32位/ 64位版本- 13.0.3),甚至没有转换到64位。

代码语言:javascript
复制
ReportDocument reportDocument = new ReportDocument();
reportDocument.Load(printPath + rptFileName);
System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();
printerSettings.PrinterName = PrinterName;
reportDocument.PrintToPrinter(printerSettings, new PageSettings(), false);
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24941858

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档