İlk önce Web Site -->Add Reference -->Com
dan Microsoft 12.0 Word Object Library i ekleyin.(Şekil 1)
Şekil 1
Şekil 3
Imports Microsoft.Office.Interop
Partial Class Default2
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oTable As Word.Table
Dim oPara1 As Word.Paragraph
Dim oPara2 As Word.Paragraph
Dim oPara3 As Word.Paragraph
Try
oWord = CreateObject("Word.Application")
oWord.Visible = True
oDoc = oWord.Documents.Add
oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = " Merhaba Dünya"
oPara1.Range.Font.Bold = True
oPara1.Range.InsertParagraphAfter()
oPara2 = oDoc.Content.Paragraphs.Add
Dim empno As String = "1"
oPara2.Range.Text = "Deneme No: " & empno
oPara2.Range.InsertParagraphAfter()
oPara3 = oDoc.Content.Paragraphs.Add
Dim ENAME As String = "Bahadır ŞAHİN"
oPara3.Range.Text = "Adı: " & ENAME
oPara3.Range.InsertParagraphAfter()
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
End Class
Bir sonraki makalede buluşmak üzere. Bahadır ŞAHİN
0 comments:
Yorum Gönder