Export as HTML with Excel Page Break

Hi,
I'm trying to export a spreadsheet with page break as html table.
How can i clear page breaks?


I tried:
ClearPageBreaks and DeleteVPageBreak(colnum) but they don't work.
Thanks Valerio

Hi,


I am not sure on why ClearPageBreaks isn't working for you , but are you sure this is the problem? 

 An html export won't have page breaks because that isn't supported in the html standard, so page breaks will be inserted by the browser when needed. We do support inserting "page-break-after" attribute that will be accepted only by internet explorer, but you can turn those off by setting the HidePrintObjects property of the HtmlExport component to not include THidePrintOptions.PageBreaks.

Can you post an example of the html file you are getting and what you would expect to get so I can get a better idea of the problem?

Regards,
   Adrian.

Hi,

 
You can download my example excel file  here http://tinyurl.com/63u778a .
I gave you an incomplete information,
the page break is a print area (excel shows it as page break, sorry).
The generated html from the export as html stops at column F.
I need to export the whole sheet, is there a method to clear print areas?
Thanks Valerio

Valerio,

Thanks for the extra information, I think I now understand the problem. Well, print areas are just named ranges with an special name (a 1-char name that Excel displays as the string "print_area"), so to remove them, you just need to remove the named ranges.
The only thing to be aware of is that you might have more than one print_area, one per sheet. To remove all print areas in a file, you can use this code:

void RemovePrintAreas(ExcelFile xls)
{

}

Note how we run the loop in reverse so when you delete a print area it won't crash the loop. Also, this will remove all print areas in all the sheets. If you want to remove a particular sheet only, you would have to do something like:

Hope this helps.
Regards,
   Adrian.

it works,

 thanks.