on 06-06-2008 3:47 AM
Hi,
I created an excelsheet for the table data using the below link
20Binary%20Cache.pdf
but problem here is when i open the excel sheet it is having some unknown columns apart from the expected like amount/#agg next to the actual column amount and it is happening only for the cloumns which have some numbers.
I dont know where these columns are coming from.
Send me the solution and points will be rewarded for the helpful answers.
I want to put some name to the excel file instead of using system created file name.for this requirement where do i need to change the code
Hi,
You can export to excel even not relating with any libraries
Follow this way..
Take one singleDimensional array, arrColNames[], and one Two dimensional array, arrValues[][].
File f=new File("Sample.xls);
FileOutputStream fos=new FileOutputStream(f);
for(int i=0;i<arrColNames.length;i++)
{
fos.write(arrLabels<i>.getBytes());
fos.write("\t".getBytes());
}
fos.write("\n".getBytes());
for(int j=0;j<noOfRows;j++)
{
String arr[]=arrValues[j];
for(int a=0;a<arr.length;a++)
{
if(arr[a]!=null)
{
fos.write(arr[a].getBytes());
fos.write("\t".getBytes());
}
}
fos.write("\n".getBytes());
}
fos.flush();
fos.close();
The exported excelFile will be stored in your server. If you want to open it using FileDownLoad UI Element,
Create value attributes resource of type Resource, behaviour of type FileDownLoadBehaviour, reso of type String, fileName of type String , Then then append this code
FileInputStream fis=new FileInputStream(f);
FileChannel fc=fis.getChannel();
byte data[]=new byte[(int)fc.size()];
ByteBuffer bb=ByteBuffer.wrap(data);
fc.read(bb);
fis.close();
IWDCachedWebResource objCachedWebresource=null;
if(data!=null)
{
objCachedWebresource=WDWebResource.getWebResource
(data,WDWebResourceType.XLS);
objCachedWebresource.setResourceName(f.getName());
}
wdContext.currentContextElement().setFileName(f.getName());
wdContext.currentContextElement().setResource(objCachedWebresource);
wdContext.currentContextElement().setReso(objCachedWebresource.getAbsoluteURL());
wdContext.currentContextElement().setBehaviour(WDFileDownloadBehaviour.ALLOW_SAVE);
Regards
LN
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bala,
I got similar problem and resolved it successfully. But I forgot it since I had done it long time ago. But can you try it like this?
Delete the attributes your node that are not necessary in the excel sheet if you have any.
To change the name of the file:
Go to the action where you are calling the Excel download function, there you can find the filename, you can set this your customized name.
Regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Nobody has encountered this kind of problem?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any Help?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.