تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[سؤال] مساعدة في التعامل مع كود
#1
اخواني الكرام من خلال بحثي عن كيفية تحويل ملف وورد الى ملف pdf وجدت كود يعمل ملفات الاوفيس ابتداءا من الاصدار 2007 
لكن مشكلتي هي كيفية استخدام هذا الكود والتعامل معه ExportAsFixedFormat 
ما الطريقة التي تجعلني أقوم بعملية الاستدعاء لهذه الدالة 
كود :
 Private Sub ConvertWordToPDF(ByVal filename As String)
       Dim wordApplication As New Microsoft.Office.Interop.Word.Application
       Dim wordDocument As Microsoft.Office.Interop.Word.Document = Nothing
       Dim outputFilename As String

       Try
           wordDocument = wordApplication.Documents.Open(filename)
           outputFilename = System.IO.Path.ChangeExtension(filename, "pdf")

           If Not wordDocument Is Nothing Then
               wordDocument.ExportAsFixedFormat(outputFilename, Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF, True, Microsoft.Office.Interop.Word.WdExportOptimizeFor.wdExportOptimizeForOnScreen, Microsoft.Office.Interop.Word.WdExportRange.wdExportAllDocument, 0, 0, Microsoft.Office.Interop.Word.WdExportItem.wdExportDocumentContent, True, True, Microsoft.Office.Interop.Word.WdExportCreateBookmarks.wdExportCreateNoBookmarks, True, True, False)
           End If
       Catch ex As Exception
           'TODO: handle exception
       Finally
           If Not wordDocument Is Nothing Then
               wordDocument.Close(False)
               wordDocument = Nothing
           End If

           If Not wordApplication Is Nothing Then
               wordApplication.Quit()
               wordApplication = Nothing
           End If
       End Try

   End Sub
Angel  الحياة فترة اختبار , إما أن تكون او لاتكون  Rolleyes  
لن امل من البحث  ولن امل من السؤال
[b]رواد المعلوميات[/b]
الرد }}}
تم الشكر بواسطة: ابراهيم ايبو


الردود في هذا الموضوع
مساعدة في التعامل مع كود - بواسطة الرائد - 02-09-19, 08:41 PM


التنقل السريع :


يقوم بقرائة الموضوع: