poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lan, Hongying" <h...@mitre.org>
Subject How to preserve character Entity Reference when writing to Excel
Date Wed, 14 Dec 2011 18:33:26 GMT
I've ran into a situation, where I need to have special characters in a cell.  For example,
if I would like to have a bullet point in a line of text within a cell, I would use the character
reference "&#8226;" to denote the bullet point.  I can construct a string such as: "&#8226;
- this is a bullet point", and then set this string as the cell value.  After the workbook
is written, if I open the workbook, I don't see the bullet point as expected, but I see the
literal string "&#8226;". If I change my workbook to a zip file, and inspect the literal
string values in the shareStrings.xml file, instead of seeing &#8226;  I see the escaped
form "&amp;#8226", which would explain why I'm seeing the string literals in the workbook,
rather than the special character.

I've tried several ways to escape "&" character when setting the cell value, so the "&"
would resolve correctly, unfortunately I hadn't had any luck. Currently, I'm working around
this issue by replacing entity references with corresponding Unicode, if there is one. 

Thank you for your help,
Hongying

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message