on 11-07-2007 9:01 AM
Hi ,
I want to generate excel spread sheet of the data in particular node. I m refering to excample given in webdynpro tutorials using WDWebResource and IWDCachedWebResource API. the xml file which i am writing before is having tags in proper sequence but when i m executing excel file using
byte[] excelXMLFile ;
excelXMLFile = xmlString.getBytes("UTF-8");
(String xmlString contains data to be displayed in Excel in xml )
But when i am opening excel sheet coloumns are diaplayed in alphabetical order. I want to dispaly coloumns in the sequence i am writing in XMl file. What to do???
Hi Kavitha,
Refer this and compare your code.
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/webDynproJava-ExportingTableDataUsingOn-DemandStreams-SAPNW+7.0&
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Try this simplified coding..
Write to File using
FileOutputStream fos=new FileOutputStream(new File("sample.xls));
for(int i=0;i<wdContext.node<nodename>.size())
{
byte b[]=wdContext.node<nodename>.get<nodename>ElementAt(i).get<field1>.getBytes();
fos.write(b);
fos.write("\t".getBytes());
b=wdContext.node<nodename>.get<nodename>ElementAt(i).get<field2>.getBytes();
fos.write(b);
fos.write("\t".getBytes());
b=wdContext.node<nodename>.get<nodename>ElementAt(i).get<field3>.getBytes();
fos.write(b);
fos.write("\t".getBytes());
fos.write("\n".getBytes());
}
Then Read From This file Using
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();
byte[] data = new byte[(int)(fc.size())];
ByteBuffer bb = ByteBuffer.wrap(data);
fc.read(bb);
IWDCachedWebResource objCachedWebResource = null;
if (data != null)
{
objCachedWebResource = WDWebResource.getWebResource(data,WDWebResourceType.XLS);
objCachedWebResource.setResourceName(f.getName());
}
wdContext.currentContextElement().setUrl(objCachedWebResource.getAbsoluteURL());
use source->OrganizeImports
select java.nio.<ClassName>
Regards
LakshmiNarayana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.