Page breaks not working as it should

I have set the pagebreaks as per the example inside the web forums and I am not getting the expected result.


I am including an image of the lines of the page break that show up when you do a print preview
They are not where I have set them, this leads to pringing that is not aligned correctly.

Am i missing something?

Here is the code
objWorkSheet.HorizontalPageBreaks.Clear();
objWorkSheet.VerticalPageBreaks.Clear();
objWorkSheet.VerticalPageBreaks.Add(“G30”);

I think I should see the page break line at the G column (inclusive) so that the print preview adjusts, but it is still where it was before the clear and set

I am including the image so that you can tell me how i can change the line position so that my page break includes the full columns and not cut off 3/4 through it

I also included a picture of what it looks like when i see the print preview, it shows me a whole bunch of stuff and no proper alignment, I guess I need help understanding aspose position on printouts, I thought by default all new worksheets in the workbook created would have a default formatting of portrait and margins that would be set to none so that what you see is what you get

Any help would be appreciated as my project was supposed to be finished yesterday (deadline) and I found out by surprise about this issue last minute.

Thank you

Hi,

Thanks for your posting and using Aspose.Cells.

If you will add vertical page break at G30, it will not include column G, it will add page break at column F.

So if you want to add page break at column G, then you should add vertical page break at H30.

I have tested this issue with the following sample code and attached the output excel file generated by it for your reference. I have also attached the screenshot that shows how the column G is included in the page break.

C#


Workbook workbook = new Workbook();


Worksheet objWorkSheet = workbook.Worksheets[0];


objWorkSheet.HorizontalPageBreaks.Clear();

objWorkSheet.VerticalPageBreaks.Clear();

objWorkSheet.VerticalPageBreaks.Add(“H30”);


workbook.Save(“output.xlsx”);

Thank you, I am testing this right now

I am adding a new screenshot, here is what I am getting after calling

objWorkSheet.HorizontalPageBreaks.Clear();
objWorkSheet.VerticalPageBreaks.Clear();
objWorkSheet.VerticalPageBreaks.Add(“J41”);

Here is the pic, I dont understand why I have ANY lines at all except my one I set when I called clear… and even then, why do I see a line before my J line…
Is there an actual limitation for pagebreaks, where it might automatically set a line on that limit then let you set a line after that limit, ?? or maybe it has to do with margins, do they affect the overall apperance of a page break when you have that in the 8x11?


Hi,

Thanks for your posting and using Aspose.Cells.

Probably this issue is occurring because of page size. Are you talking about the line between column E and F? Please provide us your source excel file so that we could look into this issue further at our end. We will investigate it and update you asap.