标签:div fixed books bsp 点击 技术分享 off 路径 for
在项目中需要将Excel文件转换为PDF格式
1:使用Invoke Power Shell控件
2:在控件中写入以下代码
1 $xlFixedFormat = ‘Microsoft.Office.Interop.Excel.xlFixedFormatType‘ -as [type] 2 $objExcel = New-Object -ComObject excel.application 3 $objExcel.visible = $false 4 5 $workbook = $objExcel.workbooks.open($ExcelFilePath, 3) 6 $workbook.Saved = $true 7 $workbook.ExportAsFixedFormat($xlFixedFormat::xlTypePDF, $PDFFilePath) 8 $objExcel.Workbooks.close() 9 10 $objExcel.Quit()
代码需以""括起来
3:添加Excel的路径以及生成PDF的路径
4:点击Run即可运行成功
标签:div fixed books bsp 点击 技术分享 off 路径 for
原文地址:https://www.cnblogs.com/kexinbao/p/10118892.html