Skip to Content
0
Dec 15, 2011 at 10:13 AM

Setting PrintOptions.PrinterName doesn´t work with SP2

3371 Views

Problem setting PrintOptions.PrinterName with Crystal Reports for Visual Studio 2010 Service Pack 2 (Version 13.0.2.469)

Framework: .Net Framework 4.0

Language: C#

Crystal Reports Version: Crystal Reports for Visual Studio 2010 Service Pack 2 (Version 13.0.2.469)

Problem: After changing some properties of objects in a report the delegation of PrintOptions.PrinterName doesnu2019t work any more. That means, itu2019s not possible any more, to assign a special printer to a report, that report is then always printed on the default printer.

Sample:

//create CrystalReport
CrystalReport1 rpt = new CrystalReport1();

//assign a Printer to the report
//here it works, the printer is set to rpt.PrintOptions.PrinterName
rpt.PrintOptions.PrinterName = "Microsoft XPS Document Writer";

//setting some properties of objects on the report
//effect: the assigned printer is gone, rpt.PrintOptions.PrinterName is empty
rpt.Section1.ReportObjects["txtTest"].ObjectFormat.EnableSuppress = false;

//assign a Printer to the report doesn´t work any more, this line of code has no effect, 
//rpt.PrintOptions.PrinterName remains empty
rpt.PrintOptions.PrinterName = "Microsoft XPS Document Writer";

This problem occurs since Service Pack 2 (Version 13.0.2.469), before the code was running without any problems.