简体   繁体   中英

C# EPPLUS - print excel file

hellow, I use EPPLUS-ExcelPackageClass and I would like to print a worksheet ? I found only a functions of the settings: public sealed class ExcelPrinterSettings : XmlHelper (for example: BlackAndWhite,BottomMargin,Draft,FitToHeight,PaperSize,PrintArea, Etc..) , what is the final command to print the file to the printer ?, Thanks a lot !

Depending on this answer, there is no printing method: Print command in EPPlus?

You can try to convert it PDF or print with Office Excel app.

It does not look like you can print to PDF using EPPlus. You can do it using Excel. If that would be beneficial to you, here is syntax that would achieve such (I used Excel 2013 and pdfcreator)

And what this does is saves the pdf in the location C:\\ExcelPDF then adds an Underscore then appends todays date in the mmddyyyy format to the end of the filename.

ActiveWorkbook.ExportAsFixedFormat (Type: Excel.XlFixedFormatType.xlTypePDF, 
Filename: "C:\ExcelPDF_" + 
DateTime.Now.ToString("MMddyyyy") + ".pdf", 
Quality: XlFixedFormatQuality.xlQualityStandard, OpenAfterPublish: false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM