Free Support Forum - aspose.com

FitToPagesTall and FitToPagesWide behaviour

Hi,

As per our requirement we need to read the FitToPages and FitToPagesTall values from the template file and set them to the output sheet, while doing so we are always getting the values as 1 even if the template is showing "Automatic", I am finding this as a weird behaviour .

I have created a new workbook through Aspose from an application, it comes up with a sheet say " sheet1", if I retrieve the values of FitToPagesTall and FitToPagesWide for this worksheet "sheet1" using sheet1.PageSetup.FitToPagesWide and sheet1.PageSetup.FitToPagesTall they are displayed as 1 for both of them, now I am saving the workbook on to the disk using Save method and then when I open the workbook using Excel the values displayed for both FitToPagesTall and FitToPagesWide on the "PageSetup" tab of the excel are "Automatic", shouldn't it be 1?

Similar is the behaviour when I create a workbook using Microsoftexcel and save it to disk, now if we open the workbook through aspose, the properties FitToPagesTall and FitToPagesWide are having 1, while the worksheet on the disk is having "Automatic".

Once if we change the values of any one property say FitToPagesWide to 1, save the file to disk and then check the other values through the aspose application then it is getting displayed 0 for FitToPagesTall.

Is this the expected behaviour or am I missing any thing?

Thanks & Regards,

Padmaja

Hi,

Thanks for providing us details.

We will investigate and look into your issue and get back to you soon. Your issue is logged into our issue tracking system with an issue id:
CELLSNET-17823.

Thank you.

Hi,

In MS Excel, there are two ways to scale the worksheet for Printing the worksheet : Adjust to zoom and Fit to page(s). The default mode is the adjusting to zoom. So, please use the property PageSetup.IsPercentScale as false, or you can set FitToPagesTall and FitToPagesWide again.

Thank you.

Hi Amjad,

Thanks for you help.

What will be the value of "IsPercentScale" property when we set both the FitToPagesTall and FitToPagesWide to false from the code, In my sample appliaction it is still showing as "False", but this is not the same behaviour in excel, in excel as we set "FitTo Pages wide and Tall value to 0 or "Automatic" the "Adjust to normal size "property becomes enable and selected one i.e. it is setting it self to True. Can you please let me know what should be the proper behaviour?

Thanks & Regards,

Padmaja

Hi,

Please see some code segments how to adjust one page wide and tall accordingly.

e.g

// Create a PageSetup object.
Aspose.Cells.PageSetup pagesetup = worksheet.PageSetup;
// Adjust to one page wide to scale the contents.
pagesetup.FitToPagesWide = 1;
pagesetup.FitToPagesTall = 0;


// Create a PageSetup object.

Aspose.Cells.PageSetup pagesetup = worksheet.PageSetup;

// Adjust to one page tall to scale the contents.

pagesetup.FitToPagesWide = 0;

pagesetup.FitToPagesTall = 1;


Note: When you choose to set FitToPagesWide or FitToPagesTall to 0 value, it means you are not setting any attribute value for it.


Thank you.