private void Export_All_PivotGrid() { PivotGridControl[] grids = new PivotGridControl[] { pivotGridControl1 }; DevExpress.XtraPrinting.PrintingSystem ps = new DevExpress.XtraPrinting.PrintingSystem(); DevExpress.XtraPrintingLinks.CompositeLink compositeLink = new DevExpress.XtraPrintingLinks.CompositeLink(ps); // Show the Document Map toolbar button and menu item. ps.SetCommandVisibility(PrintingSystemCommand.Open, CommandVisibility.All); // Make the "Export to Csv" and "Export to Txt" commands visible. ps.SetCommandVisibility(new PrintingSystemCommand[] { PrintingSystemCommand.ExportCsv, PrintingSystemCommand.ExportTxt, PrintingSystemCommand.ExportXlsx, PrintingSystemCommand.ExportDocx, PrintingSystemCommand.ExportXls }, CommandVisibility.All); compositeLink.PrintingSystem = ps; foreach (PivotGridControl grid in grids) { PrintableComponentLink link = new PrintableComponentLink(); link.Component = grid; //compositeLink.Links.Add(link); compositeLink.Links.AddRange(new object[] { link }); } string ReportName = "Daily_Status_Report"; string folderPath = "C:\\Temp\\"; string Path1 = folderPath + DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss") + "-" + ReportName + ".xlsx"; compositeLink.PrintingSystem.ExportToXlsx(Path1, new XlsxExportOptions() { ExportMode = XlsxExportMode.SingleFilePageByPage }); compositeLink.ShowPreview(); compositeLink.CreatePageForEachLink(); }
private void Export_Grid() { SplashScreenManager.ShowForm(this, typeof(Ordermanagement_01.Masters.WaitForm1), true, true, false); try { DevExpress.XtraPrinting.PrintingSystem ps_1 = new DevExpress.XtraPrinting.PrintingSystem(); DevExpress.XtraPrintingLinks.CompositeLink compositeLink_1 = new DevExpress.XtraPrintingLinks.CompositeLink(ps_1); DevExpress.XtraPrinting.PrintableComponentLink link_1 = new DevExpress.XtraPrinting.PrintableComponentLink(); DevExpress.XtraPrinting.PrintableComponentLink link_2 = new DevExpress.XtraPrinting.PrintableComponentLink(); // Show the Document Map toolbar button and menu item. ps_1.SetCommandVisibility(PrintingSystemCommand.Open, CommandVisibility.All); // Make the "Export to Csv" and "Export to Txt" commands visible. ps_1.SetCommandVisibility(new PrintingSystemCommand[] { PrintingSystemCommand.ExportCsv, PrintingSystemCommand.ExportTxt, PrintingSystemCommand.ExportXlsx, PrintingSystemCommand.ExportDocx, PrintingSystemCommand.ExportXls }, CommandVisibility.All); compositeLink_1.PrintingSystem = ps_1; link_1.Component = Grid_User_Summary; link_1.PaperName = "Niranjan"; link_2.Component = pivotGridControl2; compositeLink_1.Links.AddRange(new object[] { link_1, link_2 }); string ReportName = "Summary-Report"; string folderPath = "C:\\Temp\\"; string Path1 = folderPath + DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss") + "-" + ReportName + ".xlsx"; // compositeLink.ShowPreview(); compositeLink_1.CreatePageForEachLink(); // this is for Creating excel sheet name ps_1.XlSheetCreated += PrintingSystem_XlSheetCreated_1; compositeLink_1.PrintingSystem.ExportToXlsx(Path1, new XlsxExportOptions() { ExportMode = XlsxExportMode.SingleFilePageByPage, ExportHyperlinks = false, TextExportMode = TextExportMode.Text }); System.Diagnostics.Process.Start(Path1); } catch (Exception ex) { //Close Wait Form SplashScreenManager.CloseForm(false); MessageBox.Show("Error Occured Please Check With Administrator"); } finally { //Close Wait Form SplashScreenManager.CloseForm(false); } }
private void Export_All_PivotGrid() { GridControl[] grids = new GridControl[] { Grd_Dash_Emp_efficency, grd_Targetorder, Grid_Error_Details }; DevExpress.XtraPrinting.PrintingSystem ps = new DevExpress.XtraPrinting.PrintingSystem(); DevExpress.XtraPrintingLinks.CompositeLink compositeLink = new DevExpress.XtraPrintingLinks.CompositeLink(ps); // Show the Document Map toolbar button and menu item. ps.SetCommandVisibility(PrintingSystemCommand.Open, CommandVisibility.All); // Make the "Export to Csv" and "Export to Txt" commands visible. ps.SetCommandVisibility(new PrintingSystemCommand[] { PrintingSystemCommand.ExportCsv, PrintingSystemCommand.ExportTxt, PrintingSystemCommand.ExportXlsx, PrintingSystemCommand.ExportDocx, PrintingSystemCommand.ExportXls }, CommandVisibility.All); compositeLink.PrintingSystem = ps; foreach (GridControl grid in grids) { PrintableComponentLink link = new PrintableComponentLink(); link.Component = grid; //compositeLink.Links.Add(link); compositeLink.Links.AddRange(new object[] { link }); } string ReportName = "Accuracy_Deatils"; string folderPath = "C:\\Temp\\"; string Path1 = folderPath + DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss") + "-" + ReportName + ".xlsx"; //Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application(); //string myPath = @"15-02-2019-Accuracy_Deatils.xlsx"; //excelApp.Workbooks.Open(myPath); //// Get Worksheet //Microsoft.Office.Interop.Excel.Worksheet worksheet = excelApp.Worksheets[1]; //int rowIndex = 2; int colIndex = 2; //for (int i = 0; i < 10; i++) //{ // excelApp.Cells[rowIndex, colIndex] = "\r123"; //} //excelApp.Visible = false; compositeLink.PrintingSystem.ExportToXlsx(Path1, new XlsxExportOptions() { ExportMode = XlsxExportMode.SingleFilePageByPage }); compositeLink.ShowPreview(); compositeLink.CreatePageForEachLink(); }
public PreviewControl() { InitializeComponent(); printingSystem.SetCommandVisibility(PrintingSystemCommand.ClosePreview, DevExpress.XtraPrinting.CommandVisibility.None); fPrintBarManager = CreatePrintBarManager(printControl); }