on 10-10-2006 11:12 AM
Hi,
I want to display the contents of a table in excel format.
I have followed the below link for the same.
/people/sap.user72/blog/2006/05/04/enhancing-tables-in-webdynpro-java-150-custom-built-table-utilities
The excel is generated with all contents, but the order in which the columns appear is not same as the order in which i add them to the Arraylist. It actually takes the order of the contex attributes(of the table node).
Is there a way to change the order of the columns?
Hallo Shikha,
I refer to my Excel Export tutorial on SDN: <a href="https://wiki.sdn.sap.com/wiki/x/0mQ">Exporting Table Data Using On-Demand Streams - SAP NetWeaver 7.0</a>:
use <b>LinkedHashMap</b> instead of <i>HashMap</i>:
private Map getProductColumnInfos() {
Map columnInfosMap = new LinkedHashMap();
columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.QUANTITY, "Quantity");
columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.ARTICLE, "Article");
columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.COLOR, "Color");
columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.PRICE, "Price in EURO");
columnInfosMap.put(
IPrivateTableCompBasketView.IProductsElement.TOTAL__PER__ARTICLE,
"Total Per Article In Euro");
return columnInfosMap;
}
This keeps the order of key-displaytext-pairs passed by the client (table component) to the service (excel export component) stable.
Regards, Bertram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Shikha,
Please post your code where you creating ArrayList of column info objects.
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Below is the code:
public java.util.ArrayList getColumns( )
{
//@@begin getColumns()
ArrayList columnsList = new ArrayList();
columnsList.add(IPublicDashboardCust.IDashboardViewElement.CRID);
columnsList.add(IPublicDashboardCust.IDashboardViewElement.TYPENAME);
columnsList.add(IPublicDashboardCust.IDashboardViewElement.STATNAME);
columnsList.add(IPublicDashboardCust.IDashboardViewElement.CRDATE);
columnsList.add(IPublicDashboardCust.IDashboardViewElement.DELIBUCKAPPL);
columnsList.add(IPublicDashboardCust.IDashboardViewElement.DELIPROJAPPL);
columnsList.add(IPublicDashboardCust.IDashboardViewElement.RECVBUCKAPPL);
columnsList.add(IPublicDashboardCust.IDashboardViewElement.RECVPROJAPPL);
return columnsList;
//@@end
}
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
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.