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); }
public ActionResult Export() { var model = Product.GetProducts(); IBasePrintable gridViewPrintable = GridViewExtension.CreatePrintableObject(ViewsHelper.CreateGridViewSettings(), model); IBasePrintable pivotGridPrintable = PivotGridExtension.CreatePrintableObject(ViewsHelper.CreatePivotGridSettings(), model); XtraReport report = new SampleReport(gridViewPrintable, pivotGridPrintable); MemoryStream stream = new MemoryStream(); report.ExportToPdf(stream); return(File(stream.ToArray(), "application/pdf")); }
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); }