Skip to Content
avatar image
Former Member

Unknown column in the excel sheet created using Export to Excel

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-technology/wd%20java/wdjava%20archive/exporting%20context%20data%20into%20excel%20using%20the%20web%20dynpro%

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Jun 09, 2008 at 03:09 AM

    Any Help?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2008 at 03:56 PM

    Hi All,

    Nobody has encountered this kind of problem?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 23, 2008 at 09:24 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 23, 2008 at 09:40 AM

    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

    Add comment
    10|10000 characters needed characters exceeded