调用com.word组件实现word文档转化为pdf文档(word转pdf)
By
admin
at 2019-09-07 • 0人收藏 • 1905人看过
import win.ui; /*DSG{{*/ var winform = win.form(text="aardio form";right=759;bottom=469) winform.add( button={cls="button";text="Button";left=121;top=179;right=351;bottom=268;z=1} ) /*}}*/ import console console.open() import com winform.button.oncommand = function(id,event){ word = com.CreateObject("Word.Application"); word.Visible = false path = io.fullpath( "C:\Users\popdes\Desktop\test.doc") mydoc = word.Documents.open(path) mydoc.visible = false mydoc.ActiveDocument = true; mydoc.SaveAs("C:\Users\popdes\Desktop\test.pdf",17/*_wdFormatPDF*/); mydoc.Close(); word.Quit(); } winform.show() win.loopMessage();
以上参考于:https://www.oschina.net/question/1384894_155724
4 个回复 | 最后更新于 2023-06-30
还真可以这样,
word = com.CreateObject("Word.Application"); word.Visible = false path = io.fullpath( "C:\Users\xxx\Desktop\CAT1023WI.pdf") mydoc = word.Documents.open(path) mydoc.visible = false mydoc.ActiveDocument = false; mydoc.SaveAs("C:\Users\xxx\Desktop\CAT1023WI.doc",0/*_wdFormatDocument*/); mydoc.Close(); word.Quit();
登录后方可回帖
pdf 转换 word 应该怎么写呢?