Print scaling option "Fit all columns on one page"

Hi,
I am unable to find the a way to replicate Excel sizing option to fill all columns on one page. Is this functionality available in XlsIO?

Is there a workaround?

Thank you 
Filippo

3 Replies

AV Abirami Varadharajan Syncfusion Team March 8, 2018 06:51 AM UTC

Hi Filippo, 
 
Thank you for contacting Syncfusion support. 
 
We request you to set  FitToPagesTall property of PageSetup as 0 to enable scaling option as “Fit All Columns on One Page”. Please find the below code to achieve the same.  
 
Code Example: 
            //To set scaling as "Fit All Columns on One Page" 
            worksheet.PageSetup.FitToPagesTall = 0; 
 
Please refer below API to know more about PageSetup Properties 
 
 
Kindly try and let us know that your requirement is fulfilled. 
 
Regards, 
Abirami. 
************************************************ 
Regards, 
Abirami. 



FB Filippo Borselli March 8, 2018 11:07 AM UTC

Dear Abirami,

thank you for your reply, your suggestion works and now I can see in the print preview that all the columns fit in one page. My issue now is that I am trying to set an horizontal page break but the page break does not seems to be set when I view the document in print preview or in the page breaks view. This is the code I am using:


sheet.PageSetup.PrintArea = rangePrintArea.AddressLocal;                    

sheet.PageSetup.Orientation = ExcelPageOrientation.Portrait;

 sheet.PageSetup.FitToPagesTall = 0;

 var cellPageBreakRange = sheet[89, 1, 89, 1];

 sheet.HPageBreaks.Add(cellPageBreakRange);

Thank you in advance for your help.

Kind Regards

Filippo


AV Abirami Varadharajan Syncfusion Team March 9, 2018 10:29 AM UTC

Hi Filippo, 

Thank you for updating us. 

We are unable to reproduce the issue. The page breaks and scaling options are properly set with the shared code snippet. Kindly refer to the below sample which we have tried at our end. 


Please let us know if the sample working fine at your end. If not, kindly modify the sample to reproduce the issue and share us to validate and provide a prompt solution at the earliest. 

Regards, 
Abirami. 


Loader.
Up arrow icon