/// <summary> /// Export to XPS /// </summary> public void ExportToXPS() { // If there are no rows in the grid then we cannot export if (this.alertsDataSet.Tables[0].Rows.Count == 0) { MessageBox.Show("There is no data to Export", "Export Error"); } else { // First browse for the folder / file that we will save SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.ValidateNames = false; saveFileDialog.FileName = "alertlog.xps"; saveFileDialog.Filter = "XML Paper Specification (*.xps)|*.xps"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { UltraGridExporter.Export(saveFileDialog.FileName , "AuditWizard Alert Log" , "Generated by AuditWizard from Layton Technology, Inc." , DataStrings.Disclaimer , alertsGridView , Infragistics.Documents.Reports.Report.FileFormat.XPS); DesktopAlert.ShowDesktopAlert("Data successfully exported to '" + saveFileDialog.FileName + "'"); } } }
/// <summary> /// Export the graph data to an XLS format file /// </summary> public void ExportToXLS() { // If there are no rows in the grid then we cannot export if (this.alertsDataSet.Tables[0].Rows.Count == 0) { MessageBox.Show("There is no data to Export", "Export Error"); } else { UltraGridExporter.ExportUltraGridToExcel(alertsGridView, "alertlog"); } }
/// <summary> /// Export to PDF /// </summary> public void ExportToPDF() { // If there are no rows in the grid then we cannot export if (this.alertsDataSet.Tables[0].Rows.Count == 0) { MessageBox.Show("There is no data to Export", "Export Error"); } else { // We need to temporarily set the grid view to 'Resize all columns' in order to get // the resultant PDF file formatted correctly. AutoFitStyle oldStyle = alertsGridView.DisplayLayout.AutoFitStyle; alertsGridView.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns; // First browse for the folder / file that we will save SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.ValidateNames = false; saveFileDialog.FileName = "alertlog.pdf"; saveFileDialog.Filter = "Adobe Acrobat Document (*.pdf)|*.pdf"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { UltraGridExporter.Export(saveFileDialog.FileName , "AuditWizard Alert Log" , "Generated by AuditWizard from Layton Technology, Inc." , DataStrings.Disclaimer , alertsGridView , Infragistics.Documents.Reports.Report.FileFormat.PDF); DesktopAlert.ShowDesktopAlert("Data successfully exported to '" + saveFileDialog.FileName + "'"); } // Populate the old autofit style this.alertsGridView.DisplayLayout.AutoFitStyle = oldStyle; } }