Delphi7怎么调用Word2007另存为PDF的功能

Delphi7怎么调用Word2007另存为PDF的功能,第1张

使用vba来指定保存的文件格式为pdf,当然前提必须已安装MS Office的PDF输出插件(默认应该有)

procedure TForm1.btn1Click(Sender: TObject)

var

  wdo,wdoc,wdocs   :   OleVariant

begin

    wdo   :=   CreateOleObject('Word.Application')

    wdocs   :=   wdo.Documents

    wdoc   :=   wdocs.Open('d:\test.docx')

    wdoc.ExportAsFixedFormat(OutputFileName:=

        'd:\test.pdf', ExportFormat:=17)

        //查word的宏帮助

 {      OpenAfterExport:='True', OptimizeFor:='wdExportOptimizeForPrint', Range:=

        'wdExportAllDocument', From:=1, To:=1, Item:='wdExportDocumentContent',

        IncludeDocProps:='True', KeepIRM:='True', CreateBookmarks:=

        'wdExportCreateNoBookmarks', DocStructureTags:='True', BitmapMissingFonts:=

        'True', UseISO19005_1:='False')    }

end

仔细检查你下面这段代码。 写了多1个 end 还有缺少 分号“”

procedure TForm1.Timer1Timer(Sender: TObject)

var p:Tpoint

begin

if ((GetKeyState($11)<>0)and(GetKeyState(VKLBUTTON)<>0)) then

begin

screen.Cursors [cr MyCursor]:=loadcursorfromfile('pen.cur')

memo1.Cursor :=cryMyCursor

memo1.EndDrag(false)

GetCursorPos(p)

end //缺少 end (注意考察 你下面的else,我认为你的意思不是与这里的判断)

if((p.x>=memo1.Left )and(p.X <=(memo1.Width +MEMO1.Left )and(p.y>=memo1.Top )

and(p.Y <=(memo1.Top +memo1.Height )))then

begin

Canv.lineto(p.X ,p.Y )

//end end end //多个end 改为下面语句

end

else

memo1.Cursor:=crArrow


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/6640546.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-26
下一篇 2023-03-26

发表评论

登录后才能评论

评论列表(0条)

保存