public static void ProcessSheetWithProcessor(Worksheet sheet, ILogProcessor processor) { Sheets sheets = ThisAddIn.app.ActiveWorkbook.Sheets; // Check if the data chosen was already processed for (int n = 1; n <= sheets.Count; n++) { if (sheets[n].Name == Util.GetProcessedName(sheet.Name)) { return; } } // Disable UI updates ThisAddIn.app.ScreenUpdating = false; bool displayStatusBar = ThisAddIn.app.DisplayStatusBar; ThisAddIn.app.DisplayStatusBar = false; XlCalculation calculation = ThisAddIn.app.Calculation; ThisAddIn.app.Calculation = XlCalculation.xlCalculationManual; bool enableEvents = ThisAddIn.app.EnableEvents; ThisAddIn.app.EnableEvents = false; Worksheet outputSheet = AddSheetForOutput(sheet); System.Diagnostics.Trace.WriteLine("About to construct FastSheetReader at " + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds()); FastSheetReader reader = new FastSheetReader(sheet, processor.GetSeparator()); System.Diagnostics.Trace.WriteLine("Finished constructing FastSheetReader at " + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds()); FastSheetWriter writer = new FastSheetWriter(outputSheet); System.Diagnostics.Trace.WriteLine("Finished constructing FastSheetWriter at " + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds()); Util.RunPipeline(reader, processor, writer, true); System.Diagnostics.Trace.WriteLine("Finished running pipeline at " + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds()); writer.Flush(); System.Diagnostics.Trace.WriteLine("Flushed writer at " + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds()); // Tag the sheet with a machine type mark so we don't have to dig into the cell // data to identify machine type when trying to generate summary statistics outputSheet.CustomProperties.Add(Util.MACHINE_TYPE_MARK_NAME, processor.GetUniqueTag()); // Re-enable UI updates ThisAddIn.app.ScreenUpdating = true; ThisAddIn.app.DisplayStatusBar = displayStatusBar; ThisAddIn.app.Calculation = calculation; ThisAddIn.app.EnableEvents = enableEvents; writer.FormatPretty(); System.Diagnostics.Trace.WriteLine("Finished format pretty at " + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds()); // Don't AutoFit, as it can be really slow. outputSheet.Columns.AutoFit(); System.Diagnostics.Trace.WriteLine("Returning at " + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds()); }