windows 环境运行jacob的一些报错处理
jacob word2pdf excel2pdf PowerPoint2pdf ppt2pdfcom.jacob.com.ComFailException: VariantChangeType failed
报错信息如下
com.jacob.com.ComFailException: VariantChangeType failed
解决方案: win2008 以下 需要在 C:\Windows\System32\config\systemprofile\Desktop 建立文件夹 win2008 及以上 需要在 C:\Windows\SysWOW64\config\systemprofile\Desktop
可以直接执行下边的powershell脚本创建
if((Test-Path "C:\Windows\System32\config\systemprofile\Desktop") -ne "True")
{
New-Item -Path "C:\Windows\System32\config\systemprofile\Desktop" -ItemType Directory
}
if((Test-Path "C:\Windows\SysWOW64\config\systemprofile\Desktop") -ne "True")
{
New-Item -Path "C:\Windows\SysWOW64\config\systemprofile\Desktop" -ItemType Directory
}
SaveAs Source: Microsoft PowerPoint Description: Presentation.SaveAs : PowerPoint 无法将 ^0 保存到 ^1。
报错信息如下
SaveAs Source: Microsoft PowerPoint
Description: Presentation.SaveAs : PowerPoint 无法将 ^0 保存到 ^1。
产生原因:导出的文件路径中含有正斜杠,将其替换为反斜杠即可。 解决方案:
String path = "C:/test.pptx";
path = path.replace('/','\\');
参考资料: