We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com



We’re currently evaluating aspose.words for use in an ASP.NET application, but there’s a feature that appears to be supported that I just can’t get to work right. I’d like to be able to make a word document with multiple sections and then set the appropriate paper tray for each section, the idea being that when the document is opened in Word and printed, that each section will be pulled from the correct tray. The code that I’m using in a test document to do this is:

Dim word_doc As New Aspose.Words.Document()
Dim word_builder As New Aspose.Words.DocumentBuilder(word\_doc)

word_builder.Writeln("This is the first line, in section 0")
word_builder.Writeln("this is the first line, in section 1")

word_doc.Sections(0).PageSetup.FirstPageTray = Aspose.Words.PaperTray.MiddleBin
word_doc.Sections(1).PageSetup.FirstPageTray = Aspose.Words.PaperTray.LowerBin

word_doc.Save("results.doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response)

When this new document is downloaded to my browser and opened in Word (not inside of a browser, Word itself), I can identify each section, and I can tell that the paper tray setting in “Page Setup” has been changed from the default, but it’s always “Automatically Select”, no matter which aspose.words.papertray value I set it to. The document created in my example above, when printed, is all printed from the same tray, even though I’m setting one section to MiddleBin and one to LowerBin (my printer does have multiple trays, and I’ve tried UpperBin as well, with the same result)

The aspose.words values appear to match the Word defaults for bin placement:

Value: Name:
0 wdPrinterDefaultBin
1 wdPrinterOnlyBin
1 wdPrinterUpperBin
2 wdPrinterLowerBin
3 wdPrinterMiddleBin
4 wdPrinterManualFeed
5 wdPrinterEnvelopeFeed
6 wdPrinterManualEnvelopeFeed
7 wdPrinterAutomaticSheetFeed
8 wdPrinterTractorFeed
9 wdPrinterSmallFormatBin
10 wdPrinterLargeFormatBin
11 wdPrinterLargeCapacityBin
14 wdPrinterPaperCassette
15 wdPrinterFormSource

These values don’t appear to be valid for any printer driver that I have available, yet I can’t find out how (or if) I can make an aspose.words.papertray setting that I can use with my printer. Any ideas? I have made a word macro that can set the paper tray for each section (the values for my printer’s trays are 259 and 260, apparently), but I’d really rather not have to depend on macros for this sort of thing. Any ideas?


Hey Bob,

Thank you for reporting the issue to us. Now that you were able to use a macro to set the paper tray properly, I think we’ll add a similar functionality; just to make sure, wouldn’t setting OtherPagesTray along with FirstPageTray help?

Hi Dmitry,

Thanks for the quick response - ordinarily, I would always be setting OtherPagesTray too - but it has the same issue as the FirstPageTray - setting one of the enum values in Aspose.Words.PaperTray winds up setting the other pages on Page Setup (as viewed from within Word) to "the same “Automatic Detection” as it does for FirstPageTray (and not “Tray 1”, etc). The setting is definitely taking effect, it’s just that I think that the printer driver’s not finding a value to match MiddleBin’s translated value (for MiddleBin, I’m guessing “3” (integer)) and it assumes that anything it doesn’t specifically know about should be “Automatic Detection”.

Sort of guesswork on my end, but it’s consistent with what’s happening, I think. The actual values to be used seem to be very printer-specific. In order to find my printer’s values, I had to use Word’s “record macro” and then go pick the trays from a the list within the dialog window, and then go look at the VBA code it produced: “.FirstPageTray = 259” - picking another model of printer in our office and making the macro again gave me a different value.

Thanks again for the quick response,



That is what I thought of as well. Maybe we should expand the enumeration or expose an integer property. I have logged your request as #3006.


I have the same problem. I can’t set “PageSetup.FirstPageTray” and “PageSetup.OtherPagesTray” properties to 260 and 261. I don’t found any method to set this property with an integer.

Have you done something about request #3006 ? This feature is often requested by our customers. Is it possible to add an integer property in the next release ?



Thanks for your inquiry. Unfortunately, this issue is still unresolved. You will be notified as soon as it is fixed.

Maybe, you can try using the following code to set non-standard paper trays:

doc.FirstSection.PageSetup.FirstPageTray = (PaperTray) 260;

Best regards.

We have resolved this issue, but not by adding more PaperTray values, but by completely removing the PaperTray enum. I described the solution here https://reference.aspose.com/words/net/aspose.words/pagesetup/otherpagestray/
Let us know if you still have a problem.

The issues you have found earlier (filed as 3006) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for .NET 18.12 update and this Aspose.Words for Java 18.12 update.