I'm using Softartisans OfficeWriter
to generate Excel files. The problem I have is that whenver I assign an empty string (""
or String.Empty
) to a cell, the cell's value type will turn out to be Blank
instead of Text
, which is what I want. I've tried someCell.ValueType
, but it's a read-only property and I cannot set it to Text
manually.
Any help will be much appreciated!
Note: I work for SoftArtisans
What file format are you using? In the BIFF file format (.xls), cells assigned to an empty string will be set to a null value when the file is saved, thus causing the ValueType to return blank.
In OOXML (.xlsx) the empty string value is preserved when the file is saved, and the ValueType will return Text for any cells assigned to an empty string. You can find more information in this KB article: http://blog.softartisans.com/2013/12/30/kb-why-do-some-blank-cells-return-different-values-in-ooxml/
Would using .xlsx files be possible for you?