public ActionResult ExportTo()
        {
            var ps = new PrintingSystemBase();

            var headerImageLink = new LinkBase(ps);

            headerImageLink.CreateDetailArea += headerImageLink_CreateDetailArea;

            var link1 = new PrintableComponentLinkBase(ps);
            GridViewSettings categoriesGridSettings = new GridViewSettings();

            categoriesGridSettings.Name         = "gvCategories";
            categoriesGridSettings.KeyFieldName = "CategoryID";
            categoriesGridSettings.Columns.Add("CategoryID");
            categoriesGridSettings.Columns.Add("CategoryName");
            categoriesGridSettings.Columns.Add("Description");
            link1.Component = GridViewExtension.CreatePrintableObject(categoriesGridSettings, MyModel.GetCategories());

            var compositeLink = new CompositeLinkBase(ps);

            compositeLink.Links.AddRange(new object[] { headerImageLink, link1 });
            compositeLink.CreateDocument();

            FileStreamResult result = CreateExcelExportResult(compositeLink);

            ps.Dispose();

            return(result);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            PrintingSystemBase ps = new PrintingSystemBase();

            ps.ExportOptions.Pdf.DocumentOptions.Author = "Test";

            PrintableComponentLinkBase link1 = new PrintableComponentLinkBase(ps);

            link1.Component = ASPxPivotGridExporter1;

            PrintableComponentLinkBase link2 = new PrintableComponentLinkBase(ps);

            WebChartControl1.DataBind();
            link2.Component = ((IChartContainer)WebChartControl1).Chart;

            CompositeLinkBase compositeLink = new CompositeLinkBase(ps);

            compositeLink.Links.AddRange(new object[] { link1, link2 });

            using (MemoryStream stream = new MemoryStream()) {
                compositeLink.ExportToPdf(stream);
                Response.Clear();
                Response.Buffer = false;
                Response.AppendHeader("Content-Type", "application/pdf");
                Response.AppendHeader("Content-Transfer-Encoding", "binary");
                Response.AppendHeader("Content-Disposition", "attachment; filename=test.pdf");
                Response.BinaryWrite(stream.ToArray());
                Response.End();
            }

            ps.Dispose();
        }
    protected void ExportButton_Click(object sender, EventArgs e)
    {
        PrintingSystemBase ps = new PrintingSystemBase();

        PrintableComponentLinkBase link1 = new PrintableComponentLinkBase(ps);

        link1.Component = GridExporter;

        PrintableComponentLinkBase link2 = new PrintableComponentLinkBase(ps);

        Chart.DataBind();
        link2.Component = ((IChartContainer)Chart).Chart;

        CompositeLinkBase compositeLink = new CompositeLinkBase(ps);

        compositeLink.Links.AddRange(new object[] { link1, link2 });

        compositeLink.CreateDocument();
        using (MemoryStream stream = new MemoryStream()) {
            compositeLink.PrintingSystemBase.ExportToXls(stream);
            Response.Clear();
            Response.Buffer = false;
            Response.AppendHeader("Content-Type", "application/xls");
            Response.AppendHeader("Content-Transfer-Encoding", "binary");
            Response.AppendHeader("Content-Disposition", "attachment; filename=test.xls");
            Response.BinaryWrite(stream.ToArray());
            Response.End();
        }
        ps.Dispose();
    }
Пример #4
0
        private void ConfigureExport(ASPxGridView grid)
        {
            PrintingSystemBase ps = new PrintingSystemBase();

            ps.ExportOptions.Xlsx.SheetName = "Tipos de Documentos";

            ps.XlSheetCreated += ps_XlSheetCreated;
            PrintableComponentLinkBase link1 = new PrintableComponentLinkBase(ps);

            link1.PaperName = "DatosGenerales";
            link1.Component = Exporter;

            CompositeLinkBase compositeLink = new CompositeLinkBase(ps);

            compositeLink.Links.AddRange(new object[] { link1 });
            compositeLink.CreatePageForEachLink();

            ps.Dispose();
            grid.Settings.ShowColumnHeaders = true;
        }
    void Export(string format)
    {
        PrintingSystemBase ps = new PrintingSystemBase();

        using (headerImage = Image.FromFile(Server.MapPath("~/Images/DevExpress-Logo-Large-Color.png"))) {
            LinkBase header = new LinkBase();
            header.CreateDetailHeaderArea += Header_CreateDetailHeaderArea;

            PrintableComponentLinkBase link1 = new PrintableComponentLinkBase();
            link1.Component = this.ASPxGridViewExporter1;
            link1.CreateReportFooterArea += Link1_CreateReportFooterArea;
            CompositeLinkBase compositeLink = new CompositeLinkBase(ps);
            compositeLink.Links.AddRange(new object[] { header, link1 });

            compositeLink.CreateDocument();
            using (MemoryStream stream = new MemoryStream()) {
                switch (format)
                {
                case "xls":
                    compositeLink.ExportToXls(stream);
                    WriteToResponse("filename", true, format, stream);
                    break;

                case "pdf":
                    compositeLink.ExportToPdf(stream);
                    WriteToResponse("filename", true, format, stream);
                    break;

                case "rtf":
                    compositeLink.ExportToRtf(stream);
                    WriteToResponse("filename", true, format, stream);
                    break;

                default:
                    break;
                }
            }
            ps.Dispose();
        }
    }
Пример #6
0
    protected void ExportButton_Click(object sender, EventArgs e)
    {
        PrintingSystemBase ps = new PrintingSystemBase();

        PrintableComponentLinkBase link1 = new PrintableComponentLinkBase(ps);

        link1.Component = GridExporter1;

        PrintableComponentLinkBase link2 = new PrintableComponentLinkBase(ps);

        link2.Component = GridExporter2;

        CompositeLinkBase compositeLink = new CompositeLinkBase(ps);

        compositeLink.Links.AddRange(new object[] { link1, link2 });

        compositeLink.CreateDocument();
        using (MemoryStream stream = new MemoryStream()) {
            compositeLink.ExportToXls(stream);
            WriteToResponse("filename", true, "xls", stream);
        }
        ps.Dispose();
    }
    protected void ExportButton_Click(object sender, EventArgs e)
    {
        PrintingSystemBase ps = new PrintingSystemBase();

        PrintableComponentLinkBase link1 = new PrintableComponentLinkBase(ps);

        link1.Component = GridExporter;

        PrintableComponentLinkBase link2 = new PrintableComponentLinkBase(ps);

        link2.Component = TreeListExporter;

        PrintableComponentLinkBase link3 = new PrintableComponentLinkBase(ps);

        Chart.DataBind();
        link3.Component = ((IChartContainer)Chart).Chart;

        CompositeLinkBase compositeLink = new CompositeLinkBase(ps);

        compositeLink.Links.AddRange(new object[] { link1, link2, link3 });

        compositeLink.CreatePageForEachLink();

        using (MemoryStream stream = new MemoryStream()) {
            XlsxExportOptions options = new XlsxExportOptions();
            options.ExportMode = XlsxExportMode.SingleFilePageByPage;
            compositeLink.PrintingSystemBase.ExportToXlsx(stream, options);
            Response.Clear();
            Response.Buffer = false;
            Response.AppendHeader("Content-Type", "application/xlsx");
            Response.AppendHeader("Content-Transfer-Encoding", "binary");
            Response.AppendHeader("Content-Disposition", "attachment; filename=test.xlsx");
            Response.BinaryWrite(stream.ToArray());
            Response.End();
        }
        ps.Dispose();
    }
Пример #8
0
        public ActionResult ExportTo(int MasterRowKey)
        {
            var ps = new PrintingSystemBase();

            var link1 = new PrintableComponentLinkBase(ps);
            GridViewSettings categoriesGridSettings = new GridViewSettings();

            categoriesGridSettings.Name         = "gvCategories";
            categoriesGridSettings.KeyFieldName = "CategoryID";
            categoriesGridSettings.Columns.Add("CategoryID");
            categoriesGridSettings.Columns.Add("CategoryName");
            categoriesGridSettings.Columns.Add("Description");
            link1.Component = GridViewExtension.CreatePrintableObject(categoriesGridSettings, MyModel.GetCategories());

            var link2 = new PrintableComponentLinkBase(ps);
            GridViewSettings productsGridSettings = new GridViewSettings();

            productsGridSettings.Name         = "gvProducts";
            productsGridSettings.KeyFieldName = "ProductID";
            productsGridSettings.Columns.Add("ProductID");
            productsGridSettings.Columns.Add("ProductName");
            productsGridSettings.Columns.Add("CategoryID");
            productsGridSettings.Columns.Add("UnitPrice");
            link2.Component = GridViewExtension.CreatePrintableObject(productsGridSettings, MyModel.GetProducts(MasterRowKey));

            var compositeLink = new CompositeLinkBase(ps);

            compositeLink.Links.AddRange(new object[] { link1, link2 });
            compositeLink.CreateDocument();

            FileStreamResult result = CreateExcelExportResult(compositeLink);

            ps.Dispose();

            return(result);
        }