Free Support Forum - aspose.com

Problem with Page breaks

Hi Laurence,
Thanks for the hot fix 1.9.1.2, it works great.
Now I have a problem with page breaks. If I can make this work I can go ahead and buy Aspose.Excel.

Here are the problems:
1. when I add page breaks it does not work. When I do a page break preview the page breaks are different and when a normal view the dotted lines appear on the breaks I put in through my program but it does not break there. I think this problem was also brought up in one of the support forms.

2. In one of your support forms I read that if I insert a horizontal page break at “AA30”, the actual page break is actually the top right cell. It does not appear to be the case. the page break is actually on row 30 and not on end of row 29

3. As mentioned in my previous email the footer information still does not get carried over from the designer spreadsheet.

I am sending you the spread sheet to you with the codes I used to create the page breaks.

Thanks for the great support. Your quick support is a great factor in us deciding to buy your software

Keep up the good work

Ram



Hi Ram,

About your three questions:

1. Page break

If you want to add a page break on a cell, please add horizontal page break and vertical page break concurrently.

excel.Worksheets(0).HPageBreaks.Add(55, 28)
excel.Worksheets(0).VPageBreaks.Add(55, 28)

2. Page break is added in the top left of the cell.
Please refer to http://www.aspose.com/Products/Aspose.Excel/Api/Aspose.Excel.HPageBreaks.Add1.html.

3. I fixed the footer problem. Please download the latest hotfix at http://www.aspose.com/Products/Aspose.Excel/Fixes/Aspose.Excel.zip.

Hi Laurence
I still think there is a bug with page breaks

1. In my program if I code
sheet.HPageBreaks.Add(“AB55”)
sheet.VPageBreaks.Add(“AB55”)
where the last column that has data is AA.
it results in doted lines in view wth no result in either print or print preview.


2. If I code
sheet.HPageBreaks.Add(“AA55”)
sheet.VPageBreaks.Add(“AA55”)
where column AA also has data in it.
The sheet gets duplicated. The first copy has the vertical page breaks right (Cuts column AA)and the second copy had the horizontal pagebreaks right(Including AA).

3. Now this prompted me to code
sheet.HPageBreaks.Add(“AA55”)
sheet.VPageBreaks.Add(“AB55”)
and I got the result I expected and every thing is fine.

Please let me know if this is the way I need to code page breaks or is it a bug.

I am also sending you the excel files associated with each case.

FYI: I have the latest version 1.9.2

I have one more problem to Add regarding page breaks:

4. Aspose.Excel allows me to add only 12 pagebreaks after that though my program adds pagebreaks every one of them is omitted and then the pagebreaks are through excel default. I am sending a copy of this too…

Thanks
Ram





Hi Ram,

I got your file will investigate this issue right now. If things happen as your description, it’s really a bug and I will fix it ASAP.

Thank you.

Hi Ram,

I made a slight modification to my program. Please download the latest hotfix and have a try.

Hi Laurence
I downloaded the hot fix. It had no effect. I am sending you the spreadsheet with more information

Your Product is best suited for our needs. I just need you to fix this final glitch or suggest me a work around.

Thanks
Ram

Hi Ram,

After looking through your code and file, I think the problem was caused by the RemoveAt method. I overwrote the method and published the hotfix. Please download it and have a try. If problem still exists, could you send me more of your code(all about the pagebreaks)?

Hi Laurence,
You were right, I got rid of RemoveAt method from my code and added some logic to work around it and everything is fine. All the pagebreaks were exactly where I wanted them to be…

I think you should look into the RemoveAt method more because your hot fix still did not work with the RemoveAT method but it is not my priority anymore.


Thanks for your help

Ram

Hi Ram,

In the latest hotfix, I already modified the RemoveAt method. Have you tried it? Thanks for your help.

Hi Laurence
I did download the hotfix and tried it but it did not work. It started doing another funky thing. After the first time my program passed through the removeat method the Vertical pagebreak did not add any index to it.(pgbreakindex1 = sheet.VPageBreaks.Count ==> always gave me a value of 0, though the pagebreaks were getting added)

Please note that the removeat method worked fine for my first 13 pages and then none of my pagebreaks were added and was defaulting to excel. You could have seen it from the file I sent you.

Here is the code I use. I use ASNA Visual RPG for .Net so it might look different…
1. After I open the designer sheet I force page breaks on line 64
sheet.HPageBreaks.Add(“AA64”)
sheet.VPageBreaks.Add(“AB64”)
pgbreakrow = 64

2. As I am populating data in rows I check for page breaks
if rownum = pgbreakrow
pgbreakrow = pgbreakrow + 60
stringrow = “AA” + %trim(%EditC(pgbreakrow, “Z”))
sheet.HPageBreaks.Add(stringrow)
stringrow = “AB” + %trim(%EditC(pgbreakrow, “Z”))
sheet.VPageBreaks.Add(stringrow)
endif

3. Now every time I create a new header I check for Page break (Please note that
my header is 7 rows and I do not want my header seperated in two pages)

endrow = rownum + 7
if (pgbreakrow <= endrow)
//I remove the page breaks from current location
pgbreakindex = sheet.HPageBreaks.Count
pgbreakindex1 = sheet.VPageBreaks.Count
pgbreakindex = pgbreakindex - 1
pgbreakindex1 = pgbreakindex1 - 1
sheet.HPageBreaks.RemoveAt(pgbreakindex)
sheet.VPageBreaks.RemoveAt(pgbreakindex1)
// I add new page breaks
pgbreakrow = rownum
stringrow = “AA” + %trim(%EditC(pgbreakrow, “Z”))
sheet.HPageBreaks.Add(stringrow)
stringrow = “AB” + %trim(%EditC(pgbreakrow, “Z”))
sheet.VPageBreaks.Add(stringrow)
//Now Add the next page break
pgbreakrow = pgbreakrow + 60
stringrow = “AA” + %trim(%EditC(pgbreakrow, “Z”))
sheet.HPageBreaks.Add(stringrow)
stringrow = “AB” + %trim(%EditC(pgbreakrow, “Z”))
sheet.VPageBreaks.Add(stringrow)
endif

As I said in my previous reply, I just wanted to get this report done and when I removed the removeat method and tracked pagebreaks and added them as I was adding records everything worked fine so I am ok.

Probably sometime today I will be buying your software.
Keep up the good work

Thanks
Ram