22-07-24, 11:08 PM
(22-07-24, 04:59 PM)abu ammar كتب : ممتاز رائع .. بارك الله فيك
ممكن كود تحويل ملفات الورد الى بي دي اف ان أمكن
اليك بمثال لتحويل ملف وورد الى بي دي اف
PHP كود :
Public Class Form1
Public Sub ConvertToPDF(sInputPath As String, sOutputPath As String)
'type to be saved
Const wdFormatPDF As Integer = 17
Dim wdApp As Object
Dim wdDoc As Object
'open the file
wdApp = CreateObject("Word.Application")
wdDoc = wdApp.Documents.Open(sInputPath)
'convert it
Call wdDoc.SaveAs2(sOutputPath, wdFormatPDF)
'close and clean
wdDoc.Close()
wdApp.Quit()
wdDoc = Nothing
wdApp = Nothing
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim openFileDialog As New OpenFileDialog()
openFileDialog.Filter = "Word Files|*.docx"
If openFileDialog.ShowDialog() = DialogResult.OK Then
Dim wordPath As String = openFileDialog.FileName
Dim saveFileDialog As New SaveFileDialog()
saveFileDialog.Filter = "PDF Files|*.pdf"
saveFileDialog.Title = "Save PDF File"
If saveFileDialog.ShowDialog() = DialogResult.OK Then
Dim pdfPath As String = saveFileDialog.FileName
ConvertToPDF(wordPath, pdfPath)
MessageBox.Show("the word document has been converted to PDF successfully!")
End If
End If
End Sub
End Class

