Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
|
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 19th, 2004, 05:14 AM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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..





Similar Threads
Thread Thread Starter Forum Replies Last Post
storing special special characters in nvarchar... ACE2084 SQL Server 2000 2 February 9th, 2005 11:45 AM
SPECIAL characters... IIF MER78 BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 December 23rd, 2004 05:32 PM
Substring and special characters geordaa XSLT 4 September 24th, 2004 02:27 AM
special characters lian_a Classic ASP Basics 3 June 23rd, 2004 05:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.