我有一个有10张纸的Excel文件。我们可以在下面使用导出的表格将整个excel文件导出为一个pdf文件。
ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, outputPath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
是否可以将每张工作表导出为pdf文件?总的来说,我有10个pdf文件?
WorkSheet.SaveAs可以保存工作表,但不会导出为pdf。
谢谢
我认为您可能需要迭代工作表(电子表格和图表工作表)/工作表(仅电子表格)并分别导出每个工作表。
// add using Microsoft.Office.Interop.Excel;
// wb - workbook reference
foreach (Worksheet workSht in wb.Sheets)
{
if (workSht.UsedRange.Cells.Count > 0)
{
workSht.ExportAsFixedFormat(XlFixedFormatType.xlTypePDF,
outputPath + workSht.Name);
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句