1

Resolved

NullReferenceException accessing the Style Property

description

Even if we do:
doc.EnsureStylesDefined();
a NullReferenceException is thrown if we try to access a Style property of a Cell which do not yet has value.
Thus we have to first set Values, and then style them. But I wanted to extract the styling part to a different method and pass the WorkSheet to that method, which would style the cells before I put any data.
Also this error prevents from setting a border of an empty cell, which is relatively common scenario.

comments

punzie wrote Sep 14, 2010 at 7:25 PM

Thanks astaykov, I'm working on it.

punzie wrote Sep 14, 2010 at 7:39 PM

I've patched ExcelCell.cs, you can get it from source.

wrote Sep 14, 2010 at 7:40 PM

wrote Feb 14, 2013 at 1:50 AM

wrote May 16, 2013 at 8:00 AM

wrote May 16, 2013 at 8:00 AM

wrote Jun 14, 2013 at 6:55 AM