简体   繁体   English

C#EPPLUS-打印Excel文件

[英]C# EPPLUS - print excel file

hellow, I use EPPLUS-ExcelPackageClass and I would like to print a worksheet ? 嗨,我使用EPPLUS-ExcelPackageClass,我想打印工作表吗? 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 ! 我只找到设置的功能:公共密封类ExcelPrinterSettings:XmlHelper(例如:BlackAndWhite,BottomMargin,Draft,FitToHeight,PaperSize,PrintArea等),将文件打印到打印机的最后命令是什么?,非常感谢 !

Depending on this answer, there is no printing method: Print command in EPPlus? 根据此答案,没有打印方法: EPPlus中的打印命令?

You can try to convert it PDF or print with Office Excel app. 您可以尝试将其转换为PDF或使用Office Excel应用程序进行打印。

It does not look like you can print to PDF using EPPlus. 看起来您不能使用EPPlus打印到PDF。 You can do it using Excel. 您可以使用Excel来完成。 If that would be beneficial to you, here is syntax that would achieve such (I used Excel 2013 and pdfcreator) 如果这对您有所帮助,请使用以下语法(我使用Excel 2013和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. 这样做是将pdf保存在C:\\ ExcelPDF位置,然后添加一个下划线,然后以mmddyyyy格式将今天的日期附加到文件名的末尾。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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