Quantcast
Viewing all articles
Browse latest Browse all 3636

Crystal Report changing default setting by coding C#

Hi, This is my code

 

            CrystalDecisions.CrystalReports.Engine.ReportDocument oReportDocument = new                       CrystalDecisions.CrystalReports.Engine.ReportDocument();

            CrystalDecisions.Shared.PrintLayoutSettings oPrintLayoutSettings = new CrystalDecisions.Shared.PrintLayoutSettings();

 

 

            System.Drawing.Printing.PrintDocument oPrintDocument = new System.Drawing.Printing.PrintDocument();

            //System.Drawing.Printing.PageSettings oPageSetting = new System.Drawing.Printing.PageSettings();

            System.Drawing.Printing.PaperSize oPaperSize = new System.Drawing.Printing.PaperSize();

 

 

            oReportDocument = ObtenerReporteConProcedimientoAlmacenado(nombreReporte, ParameterArrayList, rutaReporte);

            string namePrinter = oPrintDocument.DefaultPageSettings.PrinterSettings.PrinterName;

            oReportDocument.PrintOptions.PrinterName = namePrinter;

            oReportDocument.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true;

            oPaperSize.RawKind = (int)PaperKind.Custom;

            oPaperSize.Height = 500;

            oPaperSize.Width = 880;

            oReportDocument.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)oPaperSize.Kind;

 

 

            oReportDocument.PrintToPrinter(1, false, 0, 0);

 

What I wanna do is to give the default printer the size of the paper Im using, in this case 500 , 800 ; however  when a rich oReportDocument.PrintOptions.PaperSize, the debugger stops.

 

I dont want to set a printername and neither set a pagesize by getting one from the collection of the printer.

 

Im developing in VS 2013, with CR X3. those are all the librearies references

using System;

using System.Collections;

using System.Collections.Generic;

using System.Linq;

using System.Runtime.InteropServices;

using System.Web;

using System.Web.Mvc;

using CrystalDecisions.CrystalReports.Engine;

using CrystalDecisions.ReportAppServer;

using CrystalDecisions.Shared;

using System.Drawing.Printing;

 

I hope I was clear

I hope you can help!!


Viewing all articles
Browse latest Browse all 3636

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>