[prev in list] [next in list] [prev in thread] [next in thread]
List: poi-user
Subject: Need to read symbol font ...
From: "Carmen Pancerella" <carmen () ca ! sandia ! gov>
Date: 2006-07-18 15:38:29
Message-ID: 200607181538.k6IFcT73007182 () ca ! sandia ! gov
[Download RAW message or body]
Hello.
I'm using POI to read an Excel spreadsheet and convert to a specific
XML format. I am find some special mathematical symbols and make
sure they're readable in XML. I'm using the event API, similar
to the example on the POI web site. Here's the code that I use to
recognize the Angstrom symbol:
case LabelSSTRecord.sid:
LabelSSTRecord lrec = (LabelSSTRecord) record;
UnicodeString uniStr= sstrec.getString(lrec.getSSTIndex());
String XMLString = replaceSpecialCharactersForXML(uniStr.getString());
break;
In replaceSpecialCharactersForXML, I replace the special characters
such as "&", "<", etc. for XML. I also replace the unicode characters
as such:
private String replaceSpecialCharactersForXML(String str)
{
String returnString = str;
// Special characters in XML
returnString = returnString.replaceAll("&", "&");
returnString = returnString.replaceAll("'", "'");
returnString = returnString.replaceAll("\"", """);
returnString = returnString.replaceAll("<", "<");
returnString = returnString.replaceAll(">", ">");
// Angstrom
returnString = returnString.replaceAll("\u00C5", "Å");
// Greek delta THIS DOESN'T WORK!
returnString = returnString.replaceAll("\u03B4", "δ");
}
I'm having problems recognizing some symbols that are not Unicode.
For example, the Greek Capital Delta is Symbol hex (0044). Even though
there is a Unicode to write it (as seen above), I cannot recognize
it. With other symbols, like the Angstrom, I'm able to recognize the
unicode. My resulting XML shows a capital "D" instead of the Delta.
Is there anyway to recognize the symbol font?
Thanks.
Carmen
---------------------------------------------------------------------
Carmen Pancerella, PhD carmen@ca.sandia.gov
Advanced Software Research & Development
Sandia National Laboratories Phone: (617) 630-0316
P.O. Box 969, Mailstop 9152 Voicemail: (925) 294-3538
Livermore, CA 94551-0969 Fax: (508) 300-8815
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic