protected void btExport_Click(object sender, EventArgs e)
        {
            //Exporting
            XtraReport report = new ProductsReport();

            string format   = ddlExportFormat.SelectedValue;
            string fileName = String.Format("Report.{0}", format);

            using (MemoryStream ms = new MemoryStream()) {
                switch (format)
                {
                case "pdf":
                    report.ExportToPdf(ms);
                    break;

                case "xls":
                    report.ExportToXls(ms);
                    break;

                case "xlsx":
                    report.ExportToXlsx(ms);
                    break;

                case "rtf":
                    report.ExportToRtf(ms);
                    break;

                case "mht":
                    report.ExportToMht(ms);
                    break;

                case "html":
                    report.ExportToHtml(ms);
                    break;

                case "txt":
                    report.ExportToText(ms);
                    break;

                case "csv":
                    report.ExportToCsv(ms);
                    break;

                case "png":
                    report.ExportToImage(ms, new ImageExportOptions()
                    {
                        Format = System.Drawing.Imaging.ImageFormat.Png
                    });
                    break;

                default:
                    return;
                }
                WriteDocumentToResponse(ms.ToArray(), format, false, fileName);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool printFlag;

            if (Request.QueryString["Print"] != null && Boolean.TryParse((string)Request.QueryString["Print"], out printFlag) && printFlag)
            {
                //Printing
                XtraReport report = new ProductsReport();
                using (MemoryStream ms = new MemoryStream()) {
                    report.ExportToPdf(ms, new PdfExportOptions()
                    {
                        ShowPrintDialogOnOpen = true
                    });
                    WriteDocumentToResponse(ms.ToArray(), "pdf", true, "Report.pdf");
                }
            }
        }