We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Excel Page Break not working on setting FitToPagesTall

Hi,
I have a requirement to fit 3 tables per page and compressed so that it does not take many pages.

I am using a page break after 3 tables are inserted in Excel and at the end of the excel generation. I set the page size to fit such that pages are fixed size.

sheet.PageSetup.FitToPagesTall = (For eg: 3, I set the value based onsome logic w.r.to rows on sheet)

My issue is that the page break is not working and the table is cut in the middle.

Please advise


Thanks
Bala

5 Replies

BV Bala Vennelaganti June 30, 2010 02:31 PM UTC

Please let me know if there are any other ideas.



LR Lokesh R Syncfusion Team June 30, 2010 03:22 PM UTC

Hi Bala,

Thank you very much for your interest in Syncfusion products.

We are very sorry for the delay caused in getting back to you.Could you please send us a simple issue reproducing sample, with the Excel template and also the current Essential studio version you are using in your project. So that we can further analyze on this issue.

Please, let us know if you need any clarifications.

Thanks,
Lokesh.



BV Bala Vennelaganti July 2, 2010 06:36 PM UTC

Hi Lokesh,
Here is the code. Please test and let me know if I need to make any changes. I put a page break after every 50 lines and set the page tall size to 5 pages. I guess this is not a perfect example but in our case I need to break at a point when the header changes. so I need page break to work along with FitToPagesTall.

Appreciate your help

#region TestSyncfusionXslIO
public void TestSyncfusionXslIO()
{
int row = 1, column = 1;
#region Syncfusion XLS definition
//New instance of XlsIO is created.[Equivalent to launching MS Excel with no workbooks open].
//The instantiation process consists of two steps.
//Step 1 : Instantiate the spreadsheet creation engine.
ExcelEngine excelEngine = new ExcelEngine();
//Step 2 : Instantiate the excel application object.
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(3);
HttpResponse response = HttpContext.Current.Response;
IWorksheet sheet = workbook.Worksheets[0];
;
#endregion

for (int i = 0; i < 500; i++)
{
row++;
sheet[row, 1].Text = "Page Break applied after every 50 Lines. Page Tall size set to 5. Does not break... Here is Line "+i.ToString();

if (row%50==0)
{
sheet.HPageBreaks.Add(sheet[row, column]);
}

}
sheet.PageSetup.FitToPagesTall = 5;
sheet.PageSetup.FitToPagesWide = 1;
workbook.SaveAs("TEST", ExcelSaveType.SaveAsXLS, response, ExcelDownloadType.PromptDialog);
workbook.Close();
excelEngine.Dispose();

}



BV Bala Vennelaganti July 7, 2010 01:21 PM UTC

Hi Lokesh/Syncfusion team,
Any ideas or suggestions

Thanks
Bala


LR Lokesh R Syncfusion Team July 8, 2010 01:33 PM UTC

Hi Bala,

We are very sorry for the delay caused in getting back to you.

We could see the issue at our side and logged an issue report and forwarded to the development team for further analysis. So we request you to open a new ticket to further follow up on this issue. We are sorry for the inconvenience caused.

Direct trac link:
https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please, let us know if you need any clarifications.

Thanks,
Lokesh.


Loader.
Live Chat Icon For mobile
Up arrow icon