on 10-15-2012 1:54 PM
Hi everybody,
In adapter receiver (file/FTP) , in an adapter module,
I want to create an excel file (format XLSX) ( input is the XML of normal flow).
I use apache POI to do that.
The manipulation of object XSSFWorkbook doesn't have any problem.
The problem comes when I want to convert the XSSFWorkbook created to the type ModuleData ( normal type for output ).
For an format xls , I use the workbook type HSSFWorkbook wihch has the method getByte() which convert the content of the wokbook to an array of byte ( bytes[]) which can be easily convert to ModuleData. But for the object type XSSFWorkbook that method doesn't exist.
Can somebody help me to do that conversion, please?
Kind Regards.
Eric Koralewski
Hi Eric,
May be you have to use write() method inherited from immediate super class org.apache.poi.POIXMLDocument
Try as below,
ByteArrayOutputStream baos = new ByteArrayoutputStream();
XSSFWorkbook xssfobj = xxxx; //(As part of your code logic - some manipulation to this object xssfobj )
xssfobj.write(baos); //finally write to baos
inputModuleData.setPrincipalData(baos);
return inputModuleData;
Regards,
Praveen Gujjeti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You might want to search for JExcel API for creating Excel data format. Please refer this wiki and code presented by Shabarish on this
http://wiki.sdn.sap.com/wiki/display/XI/CODE+-+Create+an+Excel+File+via+the+JExcel+API
Plus how to handle the excel files in PI document is also below
Please dont forget to rate this blog if you like it.
If you want more help on apache POI, Please share your code and required links for those api over here...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.