Dublex Printing Excel Worksheets from VB.Net
Hi All,
I am developing an excel automation application. I have almost completed it but I have a major problem at hand. After collecting some data and combining it with databases I can fill in excel sheets but when it comes to printing created file, my problem arises. I can print single pages indivudially. There are 10 sheets one of which must be printed as dublex. I searched forums and many topics especially in this forum. There are recommendations, in which printer name is introduced in the codes. However, I can not use them as my application can be used in any of hte available printers which are all able to print dublex pages. Is there any dll or code you can help me or get me started? There are also some codes for VBA to do this but in my case they are not applicable. I cannot figure out anything.
Any help is appreciated. Thank you!
Re: Dublex Printing Excel Worksheets from VB.Net
I found below code in my searchs. Does anyone know if it can work? I dont have a printer with dublex printing right away with me. I can not test it.
Quote:
Imports Microsoft.Office.Interop
Imports System.Data.OleDb
Imports System.IO
Imports System.Security.Principal
Imports System.Drawing
Imports System.Drawing.Printing
Public Class Form9
Dim xlApp As Excel.Application = CreateObject("Excel.Application")
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
Dim dir As String
Public pd As PrintDocument
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
xlApp.DisplayAlerts = False
pd = New PrintDocument
pd.PrinterSettings.Duplex = Printing.Duplex.Vertical
xlWorkBook = xlApp.Workbooks.Open(dir)
xlWorkBook.Sheets(7).printout()
xlWorkBook.Close()
xlApp.Quit()
End Sub
End Class