Beispiel #1
0
        public void TestWriteXslx()
        {
            MacroscopeJobMaster JobMaster            = new MacroscopeJobMaster(MacroscopeConstants.RunTimeMode.LIVE);
            MacroscopeExcelPageMetadataReport Report = new MacroscopeExcelPageMetadataReport();
            string Filename = string.Join(".", Path.GetTempFileName(), "xlsx");

            Report.WriteXslx(JobMaster: JobMaster, OutputFilename: Filename);
            Assert.IsTrue(File.Exists(Filename));
            File.Delete(Filename);
        }
        /** -------------------------------------------------------------------- **/

        private void CallbackSavePageMetadataExcelReport(object sender, EventArgs e)
        {
            SaveFileDialog Dialog = new SaveFileDialog();

            Dialog.Filter           = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*";
            Dialog.FilterIndex      = 2;
            Dialog.RestoreDirectory = true;
            Dialog.DefaultExt       = "xlsx";
            Dialog.AddExtension     = true;
            Dialog.FileName         = "Macroscope-Page-Metadata.xlsx";

            this.Enabled = false;

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                string Path = Dialog.FileName;
                MacroscopeExcelPageMetadataReport msExcelReport = new MacroscopeExcelPageMetadataReport();

                Cursor.Current = Cursors.WaitCursor;

                try
                {
                    msExcelReport.WriteXslx(this.JobMaster, Path);
                }
                catch (MacroscopeSaveExcelFileException ex)
                {
                    this.DialogueBoxError("Error saving Page Metadata Excel Report", ex.Message);
                }
                catch (Exception ex)
                {
                    this.DialogueBoxError("Error saving Page Metadata Excel Report", ex.Message);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }

            if (Dialog != null)
            {
                Dialog.Dispose();
            }

            this.Enabled = true;
        }
Beispiel #3
0
        /** -------------------------------------------------------------------- **/

        private void CallbackSavePageMetadataExcelReport(object sender, EventArgs e)
        {
            SaveFileDialog Dialog = new SaveFileDialog();

            Dialog.Filter           = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*";
            Dialog.FilterIndex      = 2;
            Dialog.RestoreDirectory = true;
            Dialog.DefaultExt       = "xlsx";
            Dialog.AddExtension     = true;
            Dialog.FileName         = "Macroscope-Page-Metadata.xlsx";

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                string Path = Dialog.FileName;
                MacroscopeExcelPageMetadataReport msExcelReport = new MacroscopeExcelPageMetadataReport();

                try
                {
                    if (Macroscope.MemoryGuard(RequiredMegabytes: ExcelReportMegabytesRamRequired))
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        msExcelReport.WriteXslx(this.JobMaster, Path);
                        Cursor.Current = Cursors.Default;
                    }
                }
                catch (MacroscopeInsufficientMemoryException ex)
                {
                    this.DialogueBoxError("Error saving Page Metadata Excel Report", ex.Message);
                }
                catch (MacroscopeSaveExcelFileException ex)
                {
                    this.DialogueBoxError("Error saving Page Metadata Excel Report", ex.Message);
                }
                catch (Exception ex)
                {
                    this.DialogueBoxError("Error saving Page Metadata Excel Report", ex.Message);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }

            Dialog.Dispose();
        }