View Page Breaks


#1

Hi,

Might be misunderstanding here, but every time I try to get my vpagebreak from the collection, it tells me there aren’t any. I know there’s one on the sheet I can see it if I select view page breaks in Excel.

How can I turn on/off the View page breaks option that lives in the tools, options tab in excel via your API?

Thanks

Mark


#2

Hi Mark,

Are you sure that you had set the pagebreaks in your designer spreadsheet or by API? If not, the pagebreaks showed in view option is automatically and dymamically generated by MS Excel and you cannot get it using API.

If you had already set the pagebreaks in designer file or by API but cannot get it using API, please email your designer file to excel@aspose.com and post your code here if possible.


#3

Thanks Laurence,

Ok, so there’s no way of getting auto page breaks via the API then? And I can’t use a designer so …

Here’s my problem. The sheet I create run’s across a week and has a user selected number of sub columns per day i.e.

Monday | Tuesday
Col 1 | Col 2 | Col 3 | Col 4 | Col 1 | Col 2 | Col 3 | Col 4

Now if the user has all sub columns selected to view, then the landscape page is thrown across pages, therefore it might break on Tuesday in col 2 and I have to adjust back to col 1 so complete days are shown in the export.

When doing this via COM I get the vpagebreak column and compare that to the last column in my export, if the pb is less than the last col then I adjust the page break to make sure page two contains at least one full days data.

To make things more interesting, each column the user can select is a different width so I can’t just say (n * columns) > the position of a known page break.

Is there anyway I can do this in code with aspose?

Mark


#4

Hi Mark,

Yes. You can use API to set pagebreaks as your wish. Please try this:

excel.Worksheets[0].HPagebreaks.Add(row, column);
excel.Worksheets[0].VPagebreaks.Add(row, column);