15-08-23, 08:34 PM
17-08-23, 03:03 PM
PHP كود :
Imports Microsoft.Office.Interop.Word
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim wordApp As New Application()
' إنشاء مستند جديد في وورد
Dim doc As Document = wordApp.Documents.Add()
' اضف صورة من الفورم إلى وورد
Dim image As New Bitmap(Me.Width, Me.Height)
Me.DrawToBitmap(image, New Rectangle(0, 0, Me.Width, Me.Height))
Clipboard.SetImage(image)
' لصق الصورة في مستند وورد
doc.Content.Paste()
' حفظ المستند
Dim filePath As String = "Path\To\Your\Document.docx"
doc.SaveAs2(filePath)
doc.Close()
' إغلاق تطبيق وورد
wordApp.Quit()
MessageBox.Show("تم نسخ الصورة إلى وثيقة وورد.")
End Sub
End Class