Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try indicating it is a <code>CellValues.String</code> type, instead of a <code>CellValues.Date</code> type.</p> <p>Use</p> <p><code>DataType = new EnumValue&lt;CellValues&gt;(CellValues.String) // good</code></p> <p>instead of</p> <p><code>DataType = new EnumValue&lt;CellValues&gt;(CellValues.Date) // bad</code></p> <p>Now, it would make sense to add it as <em>date</em>, without the ToString() conversion, and use the <code>CellValues.Date</code> DataType -- but <a href="http://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.cellvalue%28v=office.14%29.aspx" rel="nofollow"><strong>CellValue() only takes a <em>string</em></strong></a> as a parameter. [Why, OpenXmlSDK, <em>WHY</em>??? You're a wrapper. Wrap things nicely. Make them invisible, and make my life easier. :::sigh:::]</p> <p>Additionally, if the target cell expects to be formatting a date, we should be indicating it is a date.</p> <p>But I've found that while <code>CellValues.String</code> and <code>CellValues.Date</code> both get formatted as expected (identically), only the CellValues.Date throws throws up the "unreadable content" on-load.</p> <p>I've had utterly no luck with any variation on <code>dt.ToOADate().ToString(new CultureInfo("en-US"));</code> method -- I end up with a five-digit number that gets displayed in the spreadsheet as five-digit number, when it should be a formatted date.</p> <p>I was receiving the same error message when adding a string value, but using the <code>CellValues.Number</code> DataType.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload