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

Free Support Forum - aspose.com

What is mean by FitToPagesTall and FitToPagesWide

I wanted to save the Excel file as PDF but also want fit the excel worksheet to PDF page. My main cencern was how do i fit the worksheet which has bunch of columns. So as recommended i'm using the following code.

Aspose.Cells.Workbook document = new Aspose.Cells.Workbook(inputStream);
            <SPAN style="COLOR: blue">foreach</SPAN> (Aspose.Cells.<SPAN style="COLOR: #2b91af">Worksheet</SPAN> ws <SPAN style="COLOR: blue">in</SPAN> document.Worksheets)
            {
                ws.PageSetup.FitToPagesTall = 100;                    
                ws.PageSetup.Orientation = Aspose.Cells.<SPAN style="COLOR: #2b91af">PageOrientationType</SPAN>.Portrait;
            }
            document.Save(outputStream, Aspose.Cells.<SPAN style="COLOR: #2b91af">SaveFormat</SPAN>.Pdf);</PRE><PRE style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px">But im not sure about what FitToPagesTall and FitToPagesWide means. The website says</PRE><PRE style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px">FitToPagesTall : Represents the number of pages tall the worksheet will be scaled to when it's printed. </PRE>

FitToPagesWide : Represents the number of pages wide the worksheet will be scaled to when it's printed.

I'm not sure what is 'Tall' and 'Wide' litereally means here. Can someone exlian this with some examples?
What should be the integer value of these properties? Becuase i dont see any difference in the
output when i set 36,45,56,70 or even 100.

Hi,

3. FitToPages
Options

If developers need to fit the contents of the worksheet to desired number of pages then they can do it by using the FitToPagesTall and FitToPagesWide properties of the PageSetup class. These properties are also used for the scaling of worksheets.

Note: You can either choose FitToPages or Zoom property but not both at the same time.

Example:

[C#]

//Instantiating a Workbook object

Workbook workbook = new Workbook();

//Accessing the first worksheet in the Excel file

Worksheet worksheet = workbook.Worksheets[0];

//Setting the number of pages to which the length of the worksheet will be spanned

worksheet.PageSetup.FitToPagesTall = 1;

//Setting the number of pages to which the width of the worksheet will be spanned

worksheet.PageSetup.FitToPagesWide = 1;