Parsing special characters from java to excel
Hi,
I know this isn't _exactly_ J2EE but it IS in a J2EE application, so I'm hoping you might help:
I am creating a web report from db data which is shown in the browser as xls. I use the jakarta HSSF package to create the file, then I open it in a browser via a simple jsp and this all goes well. However, in this file I try to write the special character for 'delta'("\u0394" or #916;) and I just cant write it to the xls file. I mean, I can copy/paste it to it but if I type it in in the java file, I just get the 'square' (unknown character) in my xls document. I thought about setting content type for the window I'm opening but since I open the page via window.open(), I'm not sure if this is possible.
// code snippet for creating the xls file
int nRows = 0;
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
HSSFRow row = sheet.createRow(nRows);
row.createCell((short)1).setCellValue("\u0394" + "reading");
// end snippet
I then set the url to the file created in the request and forward to the jsp page that is to open the xls document:
//code snippet for the jsp that opens the xls:
<%
URL url = (URL)request.getAttribute("url");
%>
<html>
<head>
<script type="text/javascript">
<!--
window.open("<%=url%>");
window.close();
//-->
</script>
<title>XLS Report</title>
</head>
</html>
// end snippet
How on Earth do I get it to accept my 'delta' character??
Suggestions of all kinds are highly appreciated :)
-Drac
live long and prosper..
|