/// <summary> /// Export to XPS /// </summary> public void ExportToXPS() { // If there are no rows in the grid then we cannot export if (_currentGrid.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 = "AuditWizardData.xps"; saveFileDialog.Filter = "XML Paper Specification (*.xps)|*.xps"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { UltraGridExporter.Export(saveFileDialog.FileName , "" , "" , "" , _currentGrid , Infragistics.Documents.Reports.Report.FileFormat.XPS); DesktopAlert.ShowDesktopAlert("Data successfully exported to '" + saveFileDialog.FileName + "'"); } } }
/// <summary> /// Export to XPS /// </summary> public void ExportToXPS() { // If there are no rows in the grid then we cannot export if (this.OSDataSet.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 = headerLabel.Text + ".xps"; saveFileDialog.Filter = "XML Paper Specification (*.xps)|*.xps"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { UltraGridExporter.Export(saveFileDialog.FileName , "AuditWizard Applications View : " + OSGridView.Text , "Generated by AuditWizard from Layton Technology, Inc." , DataStrings.Disclaimer , OSGridView , Infragistics.Documents.Reports.Report.FileFormat.XPS); DesktopAlert.ShowDesktopAlert("Data successfully exported to '" + saveFileDialog.FileName + "'"); } } }
/// <summary> /// Export to PDF /// </summary> public void ExportToPDF() { // If there are no rows in the grid then we cannot export if (this._currentGrid.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 = _currentGrid.DisplayLayout.AutoFitStyle; _currentGrid.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns; // First browse for the folder / file that we will save SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.ValidateNames = false; saveFileDialog.FileName = "AuditWizardData.pdf"; saveFileDialog.Filter = "Adobe Acrobat Document (*.pdf)|*.pdf"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { UltraGridExporter.Export(saveFileDialog.FileName , "" , "" , "" , _currentGrid , Infragistics.Documents.Reports.Report.FileFormat.PDF); DesktopAlert.ShowDesktopAlert("Data successfully exported to '" + saveFileDialog.FileName + "'"); } // Populate the old autofit style this._currentGrid.DisplayLayout.AutoFitStyle = oldStyle; } }
/// <summary> /// Export to PDF /// </summary> public void ExportToPDF() { // If there are no rows in the grid then we cannot export if (this.OSDataSet.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 = OSGridView.DisplayLayout.AutoFitStyle; OSGridView.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns; // First browse for the folder / file that we will save SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.ValidateNames = false; saveFileDialog.FileName = headerLabel.Text + ".pdf"; saveFileDialog.Filter = "Adobe Acrobat Document (*.pdf)|*.pdf"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { UltraGridExporter.Export(saveFileDialog.FileName , "AuditWizard Applications View : " + OSGridView.Text , "Generated by AuditWizard from Layton Technology, Inc." , DataStrings.Disclaimer , OSGridView , Infragistics.Documents.Reports.Report.FileFormat.PDF); DesktopAlert.ShowDesktopAlert("Data successfully exported to '" + saveFileDialog.FileName + "'"); } // Populate the old autofit style this.OSGridView.DisplayLayout.AutoFitStyle = oldStyle; } }