on 07-20-2009 12:16 PM
Hi Friends,
I am trying to export table data to excel. I have considered the related posts in SDN. The pproblem I am facing is due to the NWDS version I guess. I a using CE7.1 SP05.
My code is :
cachedWebResource = WDWebResource.getPublicCachedWebResource(excelCSVFile, type, WDScopeType.APPLICATION_SCOPE,
wdThis
.wdGetAPI()
.getComponent()
.getDeployableObjectPart(),
fileName);
wdComponentAPI.getMessageManager().reportSuccess("Resource Name " + cachedWebResource.getURL());
The output is :
../../../../webdynpro/resources/demo.sap.com/jxltest/Components/com.sap.demo.jxltest.jxltestapp.comp.JxltestappComp/output81389.xls
I have no idea where from the number 81389 is appending after output. The file should be "output.xls". This is different everytime I run the program.
Need help. Any pointer will be appreciated.
Thanks,
Mickey.
Resolved the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Just for Info: In the documentation mentioned that the last parameter is key/name. So i guess it is generating an unique key every time and appending to name.
How are you giving the file name. Are you giving as "ouput.xls". If yes anyway we are specifying the resource type as xls. So please check by giving the file name as only "output".
Regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks everyone. I resolved this issue. The below code worked for me.
IWDResource cachedExcelResource = getCachedWebResource(excelCSVFile, "output.xls", WDWebResourceType.getWebResourceType("application/ms-excel", "xls"));
The method getCachedWebResource() :
private IWDResource getCachedWebResource(FileInputStream excelCSVFile, String fileName, WDWebResourceType type) {
IWDResource cachedWebResource = null;
if (excelCSVFile != null)
{
cachedWebResource = WDResourceFactory.createCachedResource(excelCSVFile, fileName, type, false);
}
return cachedWebResource;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Refer this link, step by step procedure is there,
/docs/DOC-8061#58 [original link is broken]
Regards,
Sunaina Reddy T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI
Are you creating content Excel file name.....before exoprting to excel as i meintioned in below code.....this code is running on my system.
java.io.File f = new java.io.File("output.xls");
WritableWorkbook workbook = Workbook.createWorkbook(f);
WritableFont red = new WritableFont(WritableFont.ARIAL,
WritableFont.DEFAULT_POINT_SIZE,
WritableFont.BOLD,
false,
UnderlineStyle.SINGLE,
Colour.DARK_BLUE);
WritableCellFormat redFormat = new WritableCellFormat(red);
WritableFont blue = new WritableFont(WritableFont.ARIAL,
WritableFont.DEFAULT_POINT_SIZE,
WritableFont.NO_BOLD,
false,
UnderlineStyle.NO_UNDERLINE,
Colour.BLACK);
WritableCellFormat blueFormat = new WritableCellFormat(blue);
WritableSheet sheet = workbook.createSheet("First Sheet", 0);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.