cancel
Showing results for 
Search instead for 
Did you mean: 

Unknown column in the excel sheet created using Export to Excel

Former Member
0 Kudos

Hi,

I created an excelsheet for the table data using the below link

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-tec...

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

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

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

former_member197348
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi All,

Nobody has encountered this kind of problem?

Former Member
0 Kudos

Any Help?

nikhil_bose
Active Contributor
0 Kudos

why you are using different IDs Bala subramaniya duwuri?