Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Commented Unassigned: Creating a Comment with an empty Author leads to corrupt Excel file [15358]

$
0
0
Hi EPPlus developers,

a fix from 01 Sept 2015 (65115680ca04) on ___ExcelRangeBase.AddComment___ invoked some deeper problem, which existed already before.
Creating a Comment with an empty Author
```
package.Workbook.Worksheets.First().Cells["A1"].AddComment("Text", String.Empty);
```
will lead to a cell with no __authorId__ attribute
```
<comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<authors/>
<commentList>
<comment ref="D1" >
<text>
...
```
This is not allowed by specification. See ___18.7.1 author (Author)___

> This element holds a string representing the name of a single author of comments. Every comment shall have an author.


Excel does not want to open these files either and repares them by deleting the whole comment tag. I think this is not crucial, if you will allow emty Author again. By the way, if ___Author___ property of ___ExcelComment___ class is read, when it was never set before - it throws a NullReferenceException.

Comments: Perhaps EPPlus can throw an __ArgumentException__ if a null/empty author value is used? That will make debugging much easier :-)

Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>