I'm trying to improve performance of a C# Winform project.
Previously, generate an Excel file was during 100000ms (using Office.Interop.Excel). Using ClosedXml it is about 5000ms. Really Great. But now I need to print this Excel document (only a Worksheet or the entire workbook)
I was doing this before (using office interop) :
public void PrintCurrentWorksheet()
{
this._activeWorksheet.PrintOut(Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
}
public void PrintWorkbook()
{
this._activeWorbook.PrintOut(Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
}
But now type of _activeWorkbook
and _activeWorksheet
are XLWorkbook
and IXLWorksheet
. So there is no Printout
method. I could not find a print method and I suppose there is not because OpenXml is not relied to Excel. Am I right?
I could not find a Shell command to print a Worksheet.
So, is there a simple way to print a Workbook/Worksheet without using Interop?