Symptom
- Change Crystal Report page options in a custom application.
- How to enable/disable Dissociate Formatting Page Size and Printer Page Size at runtime?
Environment
- Crystal Reports 2008
- Crystal Reports .NET SDK
Resolution
- Use the Crystal Reports .NET SDK to enable/disable the Dissociate Page Size and Printer Paper Size feature.
- The RAS .NET SDK does not modify the PrintOptions.DissociatePageSizeAndPrinterPaperSize correctly.
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.ReportDefModel;
using CrystalDecisions.ReportAppServer.Controllers;
public partial class _Default : System.Web.UI.Page
{
protected CrystalDecisions.CrystalReports.Engine.ReportDocument boReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
protected void Page_Load(object sender, EventArgs e)
{
boReportDocument.Load(Server.MapPath("CrystalReport.rpt"));
CrystalDecisions.CrystalReports.Engine.PrintOptions boPrintOptions = boReportDocument.PrintOptions;
boPrintOptions.DissociatePageSizeAndPrinterPaperSize = false;
boPrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperEnvelope11;
boPrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait;
CrystalReportViewer1.ReportSource = boReportDocument;
}
protected void Page_Unload(object sender, EventArgs e)
{
boReportDocument.Close();
boReportDocument.Dispose();
}
}
Keywords
KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To
Product
Crystal Reports 2008 V1