HI Guys,
I have written an app the prints out batches of documents for postings. Each batch is to be seperated by a red coversheet.
I know that in our printing department, no matter what printer they use to print the batches on to they will always have the red paper in Tray 2.
My issue is that when I create my coversheet as a word doc and go to print it, I want to point it at this tray. I found the tray using System.drawing.printer settings and I tried to point the Word doc at this tray but I got the following build error:
Error 1 Value of type 'System.Drawing.Printing.PaperSource' cannot be converted to 'Word.WdPaperTray'.
My code to find the tray is this ( the printer has already been selected by a combobox and I'm putting the trays into another combo so they can override):
dim strPrinter as string
strPrinter = cbBlackWhite.SelectedItem
cbRedTray.DisplayMember = "SourceName"
printDoc.PrinterSettings.PrinterName = strPrinter
For intTray = 0 To printDoc.PrinterSettings.PaperSources.Count - 1
pkSource = printDoc.PrinterSettings.PaperSources.Item(intTray)
cbRedTray.Items.Add(pkSource)
If UCase(Trim(pkSource.SourceName)) = "TRAY 2" Then
intRedTray = intTray
End If
Next
cbRedTray.SelectedIndex = intRedTray
Then when I'm printing the coversheet I was trying to use:
oDoc.PageSetup.FirstPageTray = cbRedTray.SelectedItem
oDoc.PageSetup.OtherPagesTray = cbRedTray.SelectedItem
So my question is should is there a way to convert one type to the other or which method should I be using to specify the tray?
In other words, is there a way in Word to parse through trays and get them back ? Or am I looking at using system.drawing?