This project has moved and is read-only. For the latest updates, please go here.

Illegal characters (XML) in WorkSheet sheet name

Feb 23, 2015 at 11:33 AM
I wondered a loong time, why my Excel creation corrupted with multiple sheets.
The reason was illegal characters in sheet name.
Maybe the EPPlus should just do the validation on given string or then brutally take out illegal characters of the given string.

// Replace invalid XML characters with empty strings. Dunno are these all illegal or full list.
sheetName=Regex.Replace(sheetName, @"[!@#$%_*]", "");
// Create a new sheet
currentSheet=pck.Workbook.Worksheets.Add(sheetName);