spire.xls 支持将整个excel工作薄或单个的excel工作表保存为pdf 文件格式。该文将从下面两部分介绍如何将excel文档转换为pdf格式。
- 整个excel工作薄保存为pdf
- 单个excel工作表保存为pdf
workbook to pdf
c#
workbook workbook = new workbook();
workbook.loadfromfile("test.xlsx");
//将整个工作薄保存为pdf
workbook.savetofile("workbooktopdf.pdf", spire.xls.fileformat.pdf);
vb.net
dim workbook as new workbook()
workbook.loadfromfile("test.xlsx")
'将整个工作薄保存为pdf
workbook.savetofile("workbooktopdf.pdf", spire.xls.fileformat.pdf)
worksheet to pdf
c#
workbook workbook = new workbook();
workbook.loadfromfile("test.xlsx");
//获取第一个工作表
worksheet sheet = workbook.worksheets[0];
//将第一个工作表保存为pdf
sheet.savetopdf("worksheettopdf.pdf", spire.xls.fileformat.pdf);
vb.net
dim workbook as new workbook()
workbook.loadfromfile("test.xlsx")
'获取第一个工作表
dim sheet as worksheet = workbook.worksheets(0)
'将第一个工作表保存为pdf
sheet.savetopdf("worksheettopdf.pdf", spire.xls.fileformat.pdf)