Convert Doc file to PDF in VB.Net

前端 未结 4 1240
一个人的身影
一个人的身影 2020-12-30 18:19

I have an situation where i need to convert Doc file into PDF file. I am devepoing windows application in vb.net. and also i don\'t want to user third party dll if possible.

4条回答
  •  -上瘾入骨i
    2020-12-30 18:36

    Imports Microsoft.Office.Interop
    
    'This code happens to be loading a template, but it isn't necessary...
    
    'Opens Word Application
    
    Dim MyApp As New Word.Application
    
    'Opens new WordDoc
    
    Dim MyWordDoc As Word.Document = MyApp.Documents.Add(template)
    
    MyApp.Visible = True
    
    MyWordDoc = MyApp.ActiveDocument
    
    'code to fill doc
    
    'code to fill doc
    
    'code to fill doc
    
    MyWordDoc.SaveAs(FileLocation, Word.WdSaveFormat.wdFormatPDF)
    

提交回复
热议问题