cancel
Showing results for 
Search instead for 
Did you mean: 

Wrap column in Excel

Former Member
0 Kudos

does anyone know how to wrap column in excel?

i'm trying to export data from dynpro to excel, but i can't find appropriate method to wrap text in a column.

Accepted Solutions (1)

Accepted Solutions (1)

former_member199223
Participant
0 Kudos

Hi Oscar Wijaya ,

<i>Try this coding itis working warp text ,</i>

<b>try

{

WritableWorkbook wr=Workbook.createWorkbook(new File("c:
wbook.xls"));

WritableSheet ws=wr.createSheet("First sheet",0);

WritableCellFormat integerFormat = new WritableCellFormat();

integerFormat.setWrap(true);

Label l1=new Label(0,0,"Hai");

Label l2=new Label(0,1,"Hai wgfjahkdfba");

l2.setCellFormat(integerFormat);

ws.addCell(l1);

ws.addCell(l2);

wr.write();

wr.close();

}

catch(Exception e)

{

System.out.println("ERROR");

}</b>

Regards,

Boopathi

Former Member
0 Kudos

thanks, it is working ....

Answers (3)

Answers (3)

Former Member
0 Kudos

In the code

after getting the data ..say

data = wdContext.currentListaElement().getfirstcolumn().....

place this as the argument for the cell...as shown

sheet.addCell(new Label(0,0,"data"));

Label(row,column,data)....is the format.

and finally

workbook.write();

If this does not work out check these links...

http://www.andykhan.com/jexcelapi/tutorial.html#writing

Former Member
0 Kudos
Former Member
0 Kudos

thanks again for your reply. but i need method that can be used in java NWDS.

i have try this :

WritableSheet sheet = workbook.createSheet("test",0);

WritableCellFormat c = new WritableCellFormat();

c.setWrap(true);

sheet.setColumnView(1,10,c);

it won't wrap the text. any idea?

Former Member
0 Kudos
Former Member
0 Kudos

hi kanwalpreet,

the link is for excel object. i need method which can be used in Webdynpro (of course)