Hi Zlatan,
We are fetching the data from database and then printing it to
the standard output.
Here is the snippet
//Create work book
HSSFWorkbook hwb = new HSSFWorkbook();
//Create sheet with appropriate name.
HSSFSheet sheet1 =
hwb.createSheet("ExportToExcel1");
//Create 0th row in the sheet for header
HSSFRow row = sheet1.createRow((short)0);
//Printing header and setting columnwidth.
for(int i=0;i<headerFields.size();i++){
sheet1.setColumnWidth((short)i,(short)1000);
HSSFCell testCell = row.createCell((short)i);
testCell.setCellValue((String)headerFields.get(i));
}
int rowCount = 1;
while(rs !=null && rs.next())
{
//Creating row for data.
HSSFRow rowInfo =
sheet1.createRow((short)rowCount);
int cellCount = 0;
// Printing the data for each header.
for(int i=0;i<headerFields.size();i++){
String strVal = rs.getString(i+1);
if(strVal == null)
strVal = "";
//Printing the data and setting
column width.
sheet1.setColumnWidth((short)(cellCount),(short)1000);
HSSFCell testCell =
rowInfo.createCell((short)(cellCount));
testCell.setCellValue(strVal);
cellCount++;
}
rowCount++;
}
I have tried to fetch the data for those field which has
japanese character using following method
String test16 = new String(rs.getBytes(i + 1),"UTF-16" );
String convertedStr = new String(test16.getBytes(),"UTF-8");
column[i] = convertedStr;
but its not working.
Can you tell me where i am wrong.
Regards,
PRakash.
________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag
---- On Wed, 20 Apr 2005, Zlatan Hirovic ([EMAIL PROTECTED])
wrote:
> Hi, Prakash
>
> My Problem focus on "multibyte character in Excel Header or
Footer Parts".
> Normally, Japanese character(multibyte one) can be set to
"Cell" or
> "Sheet".
>
> Could you tell me your source ?
>
> Zlatan
>
> >
> >Hi Zlatan,
> >
> >I have similar kind of problem. I am using POI to export the
> >data from JSP. We have some japanese characters in data which
> >needs to be print on to excel. It's not printing and display
as
> >a junk character. Can you tell me how to resolve this issue.
> >
> >REgards,
> >Prakash.
> >
> >
> >
> >
> >________________________________________________
> >Get your own "800" number
> >Voicemail, fax, email, and a lot more
> >http://www.ureach.com/reg/tag
> >
> >
> >---- On Wed, 20 Apr 2005, Zlatan Hirovic
([EMAIL PROTECTED])
> >wrote:
> >
> > > Hi, all
> > >
> > > I found Bug Report about it.
> > > http://issues.apache.org/bugzilla/show_bug.cgi?id=17039
> > >
> > > With this patch, I could resolve this problem.
> > > I wish that this patch should be used in latest version...
> > >
> > > Zlatan Hirovic
> > >
> > > >
> > > >Hi,
> > > >
> > > >I'm investigating Excel by Jakarta POI (HSSF).
> > > >How can I write UNICODE character in Excel Header or
Footer
> >Part ?
> > > >(I know UNICODE character put in CELL or Sheet by
> >'setEncoding'...)
> > > >
> > > >Regards
> > > >
> > > >Zlatan
> > > >
> > > >
> > > >
> > >
> >
>---------------------------------------------------------------------
> > > >To unsubscribe, e-mail:
> >[EMAIL PROTECTED]
> > > >Mailing List:
> >http://jakarta.apache.org/site/mail2.html#poi
> > > >The Apache Jakarta Poi Project:
> >http://jakarta.apache.org/poi/
> > > >
> > >
> > >
> > >
> > >
>
>---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> >[EMAIL PROTECTED]
> > > Mailing List:
> >http://jakarta.apache.org/site/mail2.html#poi
> > > The Apache Jakarta Poi Project:
> >http://jakarta.apache.org/poi/
> > >
> > >
> > >
> >
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
[EMAIL PROTECTED]
> >Mailing List:
http://jakarta.apache.org/site/mail2.html#poi
> >The Apache Jakarta Poi Project:
http://jakarta.apache.org/poi/
> >
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> Mailing List:
http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:
http://jakarta.apache.org/poi/
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/