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

Free Support Forum - aspose.com

FitToPagesWide vs AllColumnsInOnePagePerSheet

Q1: What is the difference between FitToPagesWide and AllColumnsInOnePagePerSheet?


Q2: I want to set Fit all column in one page, fit all rows in one page, fit a sheet in one page and these setting may different for different sheet.Need to set page size and orientation , how can i do these?

Hi,


Thanks for your query.

1) Well, FitToPagesWide property specifies the number of pages wide which the worksheet will be scaled to when it’s
rendered or printed. For example if you set the value 1, all the columns would be rendered on the single page (if possible), if you set the value to 2, all the columns would be rendered in two pages etc.

The AllColumnsInOnePagePerSheet attribute specifies and would always try to place all the columns in a single page if possible when rendering to PDF file format or image.

2) For your needs, please try to use the lines of code:
worksheet.PageSetup.FitToPagesTall = 1;
worksheet.PageSetup.FitToPagesWide = 1;

to render one page as all the rows and columns would be rendered in a single page if possible.

Note: I use “if possible” because if there are lots of rows and columns in the sheet, no matter you use the above mentioned attributes but sometimes it is impossible to render all the rows and columns in a single page.

If you are rendering to PDF file format or to an image file, you may always try to use OnePagePerSheet property to set it to true:
e.g
Sample code:

PdfSaveOptions options = new PdfSaveOptions();
options.OnePagePerSheet = true;
workbook.Save(“e:\test2\out1.pdf”, options);
the above code will render single PDF page for the whole sheet.


Let us know if I can be of any further help.

Thank you.