Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to export the data as integer into excel sheet?

Hi All,

I am working on export to excel functionality and using JEXCEL API to create it. When I export the data to excel sheet, the data are stored in text format in the excel sheet. If I click on summation button on excel sheet, it is not summing up the column values since it is stored as the text format.

I am writing the following code:

for(Iterator iter = columnInfos.keySet().iterator(); iter.hasNext();){

String attributeName = (String);

for(int index = 0; index < dataNode.size(); index++){


IWDNodeElement nodeElement = dataNode.getElementAt(index);

String colVal = nodeElement.getAttributeAsTex(attributeName);

Label value = new Label(j, index + 1, colVal);






Here colVal is the variable which holds the data in string format. So I was just trying to convert it into integer format and used Integer.parseInt(colVal).

But Label keyword accepts only the int,int,string arguments.

Is there any other option to change it as integer value while exporting to excel sheet.

Pls suggest.

This is very urgent.



Former Member
Former Member replied

set cell format as number

WritableCell cell = sheet.getWritableCell(2, 4);

NumberFormat twodps = new NumberFormat("####.##");
WritableCellFormat cellFormat = new WritableCellFormat(twodps);

Add Number Cell

 Number number = new Number(2, 4, colValue);


Edited by: Nikhil Bos on Apr 30, 2008 3:42 PM

0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question