public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            ProductBarcodePrintTemplate rpt = new ProductBarcodePrintTemplate();

            rpt.Site = this.Site;
            return(rpt);
        }
Ejemplo n.º 2
0
        public ProductBarcodePrintTemplateForm()
        {
            InitializeComponent();

            DataSet dsTempReport = new DataSet();

            try
            {
                string appPath = Directory.GetCurrentDirectory() + "\\" + globalConstants.ProductBarcodeXML;
                dsTempReport.ReadXml(@appPath);
                //prepare report for preview
                ProductBarcodePrintTemplate rptXMLReport = new ProductBarcodePrintTemplate();
                rptXMLReport.Database.Tables[0].SetDataSource(dsTempReport.Tables[0]);

                globalPrinterUtility gPrinter = new globalPrinterUtility();
                rptXMLReport.PrintOptions.PrinterName      = gPrinter.getConfigPrinterName(2);
                rptXMLReport.PrintOptions.PaperSize        = (CrystalDecisions.Shared.PaperSize)gPrinter.getReportPaperSize(globalPrinterUtility.LETTER_PAPER_SIZE);
                rptXMLReport.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait;

                crystalReportViewer1.ReportSource = rptXMLReport;
                crystalReportViewer1.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }