If you follow these steps you end up with a corrupted spreadsheet:
- Add comments to a worksheet
- Save and close package
- Open package
- Delete all comments (i use this line of code)
```
while (curWorksheet.Comments.Count > 0) curWorksheet.Comments.RemoveAt(curWorksheet.Comments.Count - 1);
```
- Re-add comments
- Save and close the package
Now when you try and open it in excel you will get a message like: "Removed Part: /xl/comments1.xml part with XML error. (Comments) Incorrect document syntax. Line X, column X."
```
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
-<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error035320_02.xml</logFileName><summary>Errors were detected in file '\\sh172edt\home\u413975\_ImportInProgressCAEZAHNP.xlsx'</summary>-<removedParts summary="Following is a list of removed parts:"><removedPart>Removed Part: /xl/comments1.xml part with XML error. (Comments) Incorrect document syntax. Line 19, column 27.</removedPart></removedParts></recoveryLog>
```
- Add comments to a worksheet
- Save and close package
- Open package
- Delete all comments (i use this line of code)
```
while (curWorksheet.Comments.Count > 0) curWorksheet.Comments.RemoveAt(curWorksheet.Comments.Count - 1);
```
- Re-add comments
- Save and close the package
Now when you try and open it in excel you will get a message like: "Removed Part: /xl/comments1.xml part with XML error. (Comments) Incorrect document syntax. Line X, column X."
```
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
-<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error035320_02.xml</logFileName><summary>Errors were detected in file '\\sh172edt\home\u413975\_ImportInProgressCAEZAHNP.xlsx'</summary>-<removedParts summary="Following is a list of removed parts:"><removedPart>Removed Part: /xl/comments1.xml part with XML error. (Comments) Incorrect document syntax. Line 19, column 27.</removedPart></removedParts></recoveryLog>
```