I really can't believe I'm revisiting this subject... I thought I was done with it ... but this is worth saying because it's helpful to anybody generating SSML (Excel 2003 XML dialect) whether they are interested in RS or not. I also can't believe I never figured this out before -- because I generate a lot of SSML, for all kinds of custom reports.

So last time I said this

[...] It also happens to be a situation, alluded to in my walkthrough, where you have to be careful that your dynamically-driven tab names are actually legal tab names in Excel. In this case, I used the following code to validate and change the tab names if necessary:

... looks a bit wierd and it may not turn out to be sufficient, but basically all I'm doing is taking out characters I know to be illegal. If I find more, I'll add more.

Guess what? It didn't turn out to be sufficient.

The items I'm using for tab names in this report are particularly long and (who knew?) Excel has a tab name limit of 31 characters. Before you ask, it's not in the Excel specifications and limits page as far as I can see.

Also before you ask I figured out the exact number by typing 1234512345123451234512345123451 into a tab. That last "1" is the last character Excel will let you type. If anybody has a better source of information, I'm all ears.

So, I smartened up the template you see above a little bit. In this particular workbook, we're adding some verbiage onto the end of entries for each tab, which you'll see referenced; other than that, you may be able to use this puppy.

I'm stripping blank spaces out to conserve some tablength room in this version; this isn't required, because spaces are allowed in tab names, but I was trying to save some room for more meaningful content. You'll also notice a use of two dots ("..") wherever I'm truncating a tab name, and your strategy might be slightly different...