on 12-20-2004 11:52 AM
Hi to everybody,
I have a a webdynpro view with a table and I wanto to download some of its columns to an excel file. How can I do it? I read some topics about this problem on this forum but I didn't understand completely the answers because I am not so skilled with java programming. Can you help me??
Thank you very much,
Antonio
Hi Antonio,
Check the following blog "Create an excel file from JAVA using HSSF api"
/people/prakash.singh4/blog/2005/03/16/create-an-excel-file-from-java-using-hssf-api
In this blog Prakash Singh described how to create a excel file from JAVA.
Write a method to parse through the table node and read values of the necesary value attributes and populate the excel using the HSSF api.
Hope this help to solve your problem.
Regards,
Santhosh.C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Antonio,
assuming your table is bound to a value node A with 3 columns (e.g. value attributes) CA/CB and CC you want to export the contents of this columns for a usage in Excel, it's sufficient to loop through the context nodes and create a text file where each line represents the contents of one node element and the contents of each column are separated by tabulators.
Something like this should work (exception handling and possible performance enhancements are ommitted):
PrintStream out = new PrintStream(new FileOutputStream("C:/temp/exceldump.xls"));
StringBuffer sb = new StringBuffer();
/* Output header line */
out.println("CAtCBtCC");
/* Output data lines */
for (int ix = 0; ix < wdContext.node<yourNode>().size(); ix++) {
INode<yourNode>Element el = wdContext.node<yourNode>().get<yourNode>ElementAt(ix);
sb.setLength(0);
sb.append(el.getCA()).append('t');
.append(el.getCB()).append('t');
.append(el.getCC());
out.println(sb.toString());
}
out.flush();
out.close();
Please recognize, that this is a sample only (i've written from scratch), you should for example not open a file with a hardcoded name like done here.
Hope that helps.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.