This project has moved. For the latest updates, please go here.

Removing default header/footer style markup

Jan 16, 2012 at 1:26 AM

Hello Manuel,

First of all, thank you so much for your work on ClosedXML.  I have just one improvement to suggest.

As you know, headers and footers in Excel are limited to 255 characters.  Unfortunately, ClosedXML introduces default style markup which effectively reduces this to 162 characters.  Consider the following VB.Net code:


which produces the following footer string:


As you can see, 87 characters are used to define the default style three times, when the following would be much shorter and just as effective:


The default style appears even when a custom style is defined, as shown in the following code:

ws.PageSetup.Header.Right.AddText("&22&""Times New Roman,bold""DRAFT")

which produces this:

&R&"Calibri,Regular"&11&K000000&22&"Times New Roman,bold"DRAFT

instead of this:

&R&22&"Times New Roman,bold"DRAFT

I often produce spreadsheets with ~200 characters in the footers, but I can't create them with ClosedXML because of this issue.  Could you either remove the default style markup or provide an option to define the headers/footers without this markup?

Thanks for your help,

Jan 16, 2012 at 1:31 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jan 16, 2012 at 3:14 AM

I couldn't remove "-,Regular" in a safe way so everything is out except this tag.

Thanks for feedback.