Load Workbook with specified Printer Paper Size
Contents
[
Hide
]
You can specify the printer paper size of your choice while loading your workbook using the LoadOptions.set_paper_size() method. Please note, if you create a new file in MS Excel, you will find the paper size is the same as the setting of the default printer in your machine.
The following sample code illustrates the usage of LoadOptions.set_paper_size() method. It first creates a workbook, then saves it in memory stream in XLSX format. Then it loads it with A5 paper size and saves it in PDF format. Then it loads it again with A3 paper size and saves it again in PDF format. If you open the output PDFs and check their paper size, you will see they are different. One is A5 and the other is A3. Please download the A5 output PDF and A3 output PDF generated by the code for your reference.