i want to create a bottun that create a docuent, open it and print it in duplex mode.
.NET has a "printersettings" command that can print documents even in duplex, my problem is that i can't find the way to print the opened doc. it is very importend to open it because i want the program to make some changes in the doc context.
i include the code:
Private Sub printbottun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim oWord As Object
Dim oDoc As Object
Dim printer As String
Dim pd As New PrintDocument()
oWord = CreateObject("Word.application")
oWord.Visible = True
oDoc = oWord.Documents.Add
oDoc.Range.Select()
oWord.Selection.TypeText("This is on page 1" & vbCr)
oWord.Selection.InsertBreak(1)
oWord.Selection.TypeText("This is page 2")
pd.PrinterSettings.Duplex = Duplex.Simplex
pd.DocumentName = "documnet1"
odoc.Print()
end sub
the problem is that the odoc document is printing with out any connection to the printersetting i made!!!
.NET has a "printersettings" command that can print documents even in duplex, my problem is that i can't find the way to print the opened doc. it is very importend to open it because i want the program to make some changes in the doc context.
i include the code:
Private Sub printbottun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim oWord As Object
Dim oDoc As Object
Dim printer As String
Dim pd As New PrintDocument()
oWord = CreateObject("Word.application")
oWord.Visible = True
oDoc = oWord.Documents.Add
oDoc.Range.Select()
oWord.Selection.TypeText("This is on page 1" & vbCr)
oWord.Selection.InsertBreak(1)
oWord.Selection.TypeText("This is page 2")
pd.PrinterSettings.Duplex = Duplex.Simplex
pd.DocumentName = "documnet1"
odoc.Print()
end sub
the problem is that the odoc document is printing with out any connection to the printersetting i made!!!