Export data from an iView to Excel, get a login screen displayed in Excel

Hi
I'm trying to export data from a tableview to excel, I followed the instruction posted by Detlev Beutner, created a class extends AbstractPortalComponent, and overwrote the doOnNodeReady:
HttpServletResponse response = request.getServletResponse(true);
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "filename=\"text.xls\"");
I did write some test output in doContent:
         aResponse.write("Filed11,Filed12,Field13");
         aResponse.write("Field21,Field22,Field23");
I was hoping to see the excel to display the content "Field11 Field12...", but I got a portal login screen displayed in Excel.
Does anyone have the same experience and and idea on this?
Thanks
Yutong

Sure, here is the sample code for method doOnNodeReady
protected void doOnNodeReady(IPortalComponentRequest request,
      IEvent event)
  //set http content type to excel format
  HttpServletResponse response = request.getServletResponse(true);
  response.setContentType("application/vnd.ms-excel");
  response.setHeader("Content-Disposition", "attachement;filename=\"abc.xls\"");
  java.io.PrintWriter out = response.getWriter();
  // print out the header
  out.print(headerSubject + "\t");
  out.print(headerDueDate + "\t");
  // then print out your data
  out.close();

Similar Messages

  • Error while exporting data from sql server to excel

    Hi,
    I am trying to export data from sql server to excel.
    The query that I used is s follows
    INSERT INTO OPENROWSET( 'Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Folder1\abc.xls','select * from [Sheet1$A1:IV65000]')
    select 
    column1,column2.... from Table1
    I get the following error message while doing so..
    String or binary data would be truncated.
    The statement has been terminated.
    One of the column's holds data more than 225 characters.
    What is the way to correct this, i want the whole data of the colum in the excel sheet.

    I haven't had great luck with the INSERT INTO OPENROWSET method.  Can you try one of the many samples from one of these 3 links?
    http://www.excel-sql-server.com/excel-sql-server-import-export-using-vba.htm#Excel%20Data%20Export%20to%20SQL%20Server%20Test%20Code 
    http://www.mssqltips.com/sqlservertip/1540/insert-update-or-delete-data-in-sql-server-from-excel/
    https://www.simple-talk.com/sql/database-administration/getting-data-between-excel-and-sql-server-using-odbc--/
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Exporting data from a multiple worksheet excel to oracle database.

    Hi,
    Am having a very big problem,i have to export data from excel to database.My excel is havin multiple worksheet.
    I thought of most of the options nothing is suiting my layout.
    SQL loader ,can't use due to multiple worksheet.
    HSServices can;t use because my column headings are row wise,and the excel start with a big Heading rather than having column headings.
    UTL_FILE can't use beacuse of multiple worksheet,and frankly speaking i don't know how to use utl file with excel to read paticular cell in excel.
    Thanks

    First of all: this is a forum of volunteers.
    So no one is obliged to respond to you.
    Therefore 'urgent' does not exist in this forum, and labeling your request as 'urgent' is considered rude by many. If it is really that urgent, submit a prio 1 request at Metalink.
    Secondly, I don't think you thought of most of the options.
    Yes, you can use SQL*Loader as you can dump each individual worksheet to a separate CSV file.
    Also, you didn't consider ODBC. If ODBC in Excel is too cumbersome, you can use MsAccess to hook the Excel sheet in Msaccess, connect to the database using the Oracle ODBC driver and design an ordinary append query,
    Obviously, you would need one query per worksheet.
    Hth
    Sybrand Bakker
    Senior Oracle DBA

  • How to Export data from a Table to Excel using PL/SQL Code

    Hi,
    I need to export data from a table to the excel sheet using PL/SQL script.
    could you pls provide with custom codes or sample procedures.
    Bobby

    http://asktom.oracle.com/pls/ask/f?p=4950:8:7947129213057862756::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:728625409049

  • SSIS: Export data from ODBC source to Excel only 5000 rows at a time

    Greetings,
    Im inserting data into Excel using SSIS.
    Im getting the following exception:
    '[Excel Destination [32]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
    An OLE DB record is available. Source: "Microsoft Office Access Database Engine" Hresult: 0x80004005 Description: "Spreadsheet is full.".'
    I did some research using the following link:
    http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP010073849.aspx
    It states that you can populate the maximum of 1,048,576 rows by 16,384 columns
    The data i am importing into Excel is only about 100,000 rows by 5 columns
    After doing some research I am now aware that this is to much data for Excel to handle at one time.  I was advised to lower the amount of rows SSIS is exporting into Excel........How do I lower the amount of rows to 5,000 at a time is SSIS?

    Having the maxbufferrowsize
    But I have a doubt that it is related. You probably max up the allowed size for your version of Excel.
    Arthur My Blog

  • Problem in exporting data from alv output to excel

    Hi,
    I had developed  a report which has ALV report output.It is working fine and i am facing problem that when i am exporting it to the data to excel,it is not displaying the whole data in it. I am using reuse_alv_grid_display function module.
    Waiting for a positive response.
    Thanks & Regards,
    Rickky
    Moderator Message: FAQ. Please search for available information before posting.
    Edited by: kishan P on Nov 8, 2010 12:34 PM

    It is highly likely that the way you have built your field catalog is causing some data to drop on the export to excel. I have had this problem before. Check the fields in your fieldcat that are not working vs the ones that are working.

  • Exporting filterded data from a view to excel

    I have a requirement, where i have to export data from a list to excel after applying some filter to it.
    Say i filter the view by selecting employee dept="Teaching", now i want to export only the filtered rows to excel.
    Is there any way to achieve this.
    Thanks in advance.

    Hi,
    You can create a view with required filters. Then you can export to excel after switching on to filtered view.Refer following link to create filtered view.
    http://office.microsoft.com/en-in/sharepoint-workspace-help/create-view-filters-in-a-lists-tool-design-in-sharepoint-workspace-2010-HA010336352.aspx
    Hope it helps!
    Avni Bhatt

  • BI 4.0 sp 6 service name to export data from webi to excel

    Hi there,
    I'm using BI 4.0 SP6 and I was just curious to find out which servers/services are invoked while exporting data from WebI report to Excel?
    Thanks in advance.
    Regards,
    samique

    Check below section in the Admin guide for this information.
    Architecture\Process Workflows

  • Export data from a table (not a bi query) to pdf

    Hi experts,
    I would like to know the way to export data in VC 7.0 from a table to a pdf. This table is generated NOT from a BI query but from an SQL using connection to Oracle DBMS.
    Thank you all
    Alessandro

    Hi,
    Use this link:[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/47fe4fef-0d01-0010-6f87-ed8ecb479123]
    and Go through he below thread.
    [Re: Export data from visual composer to excel]
    Regards,
    Govindu
    If helpful reward points

  • Unable to export data from Web Access Data Sheet in Sharepoint to local excel or access file

    Greetings and good morning.
    I'm going to start off in broad terms with this question because I'm not 100 percent sure what information to provide.
    Long story short, we've got a Web Access Data Sheet list hosted in a Sharepoint 2010 environment. It is accessed and used by multiple people throughout the day. It contains several thousand line item entries. I'd call it a large data sheet.
    I think the size of the data sheet is casuign some instability in the list. I'd like to be able to export a defined range of data from the list into a local excel or access file. After that, I'd delete the stuff on the Access list to improve performance.
    But...when I attempt to use the Sharepoint Action bar to export - Excel locks up/crashes. If I try to export to Access, I get a similar issue.
    Any ideas? Could anyone begin by telling me what other information is required?

    Hi,
    If you would like to export data from Access Web Database in SharePoint 2010, you could go to Design With Access page in Settings. The url in my environment is http://sp/tt/_layouts/accsrv/ModifyApplication.aspx . Then choose the Table and export it to Excel
    or Modify it in Access.
    Regards,
    Rebecca Tu
    TechNet Community Support

  • How can we export the data from OAF Page to Excel instead of .csv or .txt

    Hello,
    How can we export the data from OAF Page to Excel instead of .csv or .txt
    When i click on the export button it is exporting to txt file, But i need to export the data into Excel by default
    Please help me
    Thanks in advance
    Thanks,
    Raju
    We have changed the below profile option to get the data in excel by default
    Profile Name Export MIME type
    Profile Code FND_EXPORT_MIME_TYPE+
    Existing Value: text/tab-separated-values+
    Change as: Excel
    Thank you,
    Raju
    Edited by: 1006649 on May 21, 2013 10:55 AM

    We have changed the below profile option to get the data in excel by default
    Profile Name Export MIME type
    Profile Code FND_EXPORT_MIME_TYPE+
    Existing Value: text/tab-separated-values+
    Change as: Excel
    Thank you,
    Raju

  • Error while exporting data from ABAP to Excel

    Hello All,
    iam trying to download data from ABAP scrn to Excel using I_OI_SPREADSHEET METHODS. I get an error in method 'SET_RANGES_DATA' - 'Memory protection fault occurred in document interface'.
    I have pasted my code below. Kindly help me to solve this issue.
    Create container ??
      CALL METHOD c_oi_container_control_creator=>get_container_control
        IMPORTING
          control = g_control
          error   = g_error.
    Initialize
      CALL METHOD g_control->init_control
        EXPORTING
          r3_application_name      = 'Basis'
          parent                   = g_container
         register_on_close_event  = c_reg_on_close_event
         register_on_custom_event = c_reg_on_custom_event
         no_flush                 = c_no_flush
        IMPORTING
          error                    = g_error.
    Set Doc type
      g_document_type = 'Excel.Sheet'.
    Create Proxy
      CALL METHOD g_control->get_document_proxy
        EXPORTING
          document_type  = g_document_type
        IMPORTING
          document_proxy = g_document
          error          = g_error.
      CALL METHOD g_document->create_document
        EXPORTING
          document_title = 'Excel'.                             "#EC NOTEXT
      CALL METHOD g_document->get_spreadsheet_interface
        IMPORTING
          sheet_interface = g_handle.
      CHECK g_document IS NOT INITIAL.
    read selected line data from gtab
      READ TABLE g_tab_data INDEX 1  INTO l_wa_pos_trans.
    Get Field Descriptions
      CALL FUNCTION 'DDIF_FIELDINFO_GET'
        EXPORTING
          tabname        = 'TRIGS_EXPORT_EXCEL'
          langu          = sy-langu
        TABLES
          dfies_tab      = lt_dfies
        EXCEPTIONS
          not_found      = 1
          internal_error = 2
          OTHERS         = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Header for User Data
      l_h_cnt  = 1.
      LOOP AT lt_dfies INTO lwa_dfies.
        IF lwa_dfies-fieldname EQ 'USER_ID'          OR
           lwa_dfies-fieldname EQ 'EXCEL_DATE'       OR
           lwa_dfies-fieldname EQ 'EXCEL_TIME'       OR
           lwa_dfies-fieldname EQ 'SECURITY_ACCOUNT' OR
           lwa_dfies-fieldname EQ 'SECURITY_ID'      OR
           lwa_dfies-fieldname EQ 'COMPANY_CODE'.
          PERFORM fill_cell USING l_h_cnt 1 1 lwa_dfies-scrtext_m.
          l_h_cnt  =  l_h_cnt  + 1.
        ENDIF.
      ENDLOOP.
    Fill Header Values
      PERFORM fill_cell USING 1 2 1 sy-uname.
      PERFORM fill_cell USING 2 2 1 sy-datum.
      PERFORM fill_cell USING 3 2 1 sy-uzeit.
      PERFORM fill_cell USING 4 2 1 l_wa_pos_trans-company_code .
      PERFORM fill_cell USING 5 2 1 l_wa_pos_trans-security_account.
      PERFORM fill_cell USING 6 2 1 l_wa_pos_trans-security_id.
    Texts
    l_h_cnt = l_h_cnt + 1.
      PERFORM fill_cell USING l_h_cnt 1 1 text-011.
      PERFORM fill_cell USING l_h_cnt 3 1 text-012.
    Range for header
      range_item-name = 'RANGE1'.
      range_item-rows = '7'.
      range_item-columns = '3'.
      range_item-code = g_handle->spreadsheet_insertall.
      APPEND range_item TO range_list.
      CALL METHOD g_handle->set_selection
        EXPORTING
          left    = 1
          top     = 1
          rows    = 7
          columns = 3
        IMPORTING
          retcode = retcode.
      CALL METHOD g_handle->insert_range
        EXPORTING
          columns = 3
          rows    = 7
          name    = 'RANGE1'
        IMPORTING
          retcode = retcode.
      CALL METHOD g_handle->set_ranges_data
        EXPORTING
          ranges   = range_list
          contents = gt_cell_data
        IMPORTING
          retcode  = retcode.
    Columns for PC
      CLEAR: gt_cell_data[].
      l_pc_cnt  = l_h_cnt + 1.
      LOOP AT lt_dfies INTO lwa_dfies.
        IF lwa_dfies-fieldname EQ 'SBWHR' OR
           lwa_dfies-fieldname CP '_PC'.
          PERFORM fill_cell USING l_pc_cnt 1 0 lwa_dfies-scrtext_m.
          l_pc_cnt =  l_pc_cnt + 1.
        ENDIF.
      ENDLOOP.
    Pos Curr - Values
      PERFORM fill_cell USING 9 2 0  trls_position_value-sbwhr.
      PERFORM fill_cell USING 10 2 0 trls_position_value-purch_pc.
      PERFORM fill_cell USING 11 2 0 trls_position_value-charge_pc.
      PERFORM fill_cell USING 12 2 0 trls_position_value-impmnt_pc.
      PERFORM fill_cell USING 13 2 0 trls_position_value-amort_pc.
      PERFORM fill_cell USING 14 2 0 trls_position_value-val_ti_pc.
      PERFORM fill_cell USING 15 2 0 trls_position_value-val_idx_pc.
      PERFORM fill_cell USING 16 2 0 trls_position_value-val_ch_ti_pc.
      PERFORM fill_cell USING 17 2 0 trls_position_value-val_ti_npl_pc.
      PERFORM fill_cell USING 18 2 0 trls_position_value-val_idx_npl_pc.
      PERFORM fill_cell USING 19 2 0 trls_position_value-val_ch_ti_npl_pc.
      PERFORM fill_cell USING 20 2 0 trls_position_value-book_val_pc.
    Columns for VC
      l_vc_cnt = l_h_cnt + 1.
      LOOP AT lt_dfies INTO lwa_dfies.
        IF lwa_dfies-fieldname EQ 'SBWHR' OR
             lwa_dfies-fieldname CP '_VC'.
          PERFORM fill_cell USING l_vc_cnt 3 0 lwa_dfies-scrtext_m.
          l_vc_cnt =  l_vc_cnt + 1.
        ENDIF.
      ENDLOOP.
    Val Curr
      PERFORM fill_cell USING 9 4 0  trls_position_value-svwhr.
      PERFORM fill_cell USING 10 4 0 trls_position_value-purch_vc.
      PERFORM fill_cell USING 11 4 0 trls_position_value-charge_vc.
      PERFORM fill_cell USING 12 4 0 trls_position_value-impmnt_vc.
      PERFORM fill_cell USING 13 4 0 trls_position_value-amort_vc.
      PERFORM fill_cell USING 14 4 0 trls_position_value-val_ti_vc.
      PERFORM fill_cell USING 15 4 0 trls_position_value-val_fx_vc.
      PERFORM fill_cell USING 16 4 0 trls_position_value-val_idx_vc.
      PERFORM fill_cell USING 17 4 0 trls_position_value-val_ch_ti_vc.
      PERFORM fill_cell USING 18 4 0 trls_position_value-val_ch_fx_vc.
      PERFORM fill_cell USING 19 4 0 trls_position_value-val_fx_npl_vc.
      PERFORM fill_cell USING 20 4 0 trls_position_value-val_ti_npl_vc.
      PERFORM fill_cell USING 21 4 0 trls_position_value-val_idx_npl_vc.
      PERFORM fill_cell USING 22 4 0 trls_position_value-val_ch_ti_npl_vc.
      PERFORM fill_cell USING 23 4 0 trls_position_value-val_ch_fx_npl_vc.
      PERFORM fill_cell USING 24 4 0 trls_position_value-book_val_vc.
    Range for PC and VC
      CLEAR: range_list[].
      range_item-name = 'RANGE2'.
      range_item-rows = '17'.
      range_item-columns = '4'.
      range_item-code = g_handle->spreadsheet_insertall.
      APPEND range_item TO range_list.
      CALL METHOD g_handle->set_selection
        EXPORTING
          left    = 1
          top     = 9
          rows    = 17
          columns = 4
        IMPORTING
          retcode = retcode.
      CALL METHOD g_handle->insert_range
        EXPORTING
          columns = 4
          rows    = 17
          name    = 'RANGE2'
        IMPORTING
          retcode = retcode.
      CALL METHOD g_handle->set_ranges_data
        EXPORTING
          ranges   = range_list
          contents = gt_cell_data
        IMPORTING
          retcode  = retcode.
    ***********************************Form routine****************
    FORM fill_cell USING i j bold val.
      DATA:
       wa_cell_data TYPE soi_generic_item.
      wa_cell_data-row = i.
      wa_cell_data-column = j.
      wa_cell_data-value = val.
      APPEND wa_cell_data TO gt_cell_data.
    ENDFORM.                    "FILL_CELL

    Solved

  • Looking for example to export data from a DynPro table to Excel file

    Hello,
    I have a certain content in a table.
    I would like to export this content to Excel file and let the user save it on his PC. I tried to use the Office Controller but with no success.
    Have someone already made something like this and can show me an example?

    Hi
    I already explained this in another post. Anyway i will cut and paste the same for you.Here you go.Sample way to create a Excel file and then download it to a local pc using a FileUI Download element.
    We are developing a generic component for the same requirement which will download data to a excel from any table.
    Anyway here is something which will give you some kind of idea as to how you can write the data from WebDynpro to a excel file.
    For running this application
    Ensure that the requisite JAR files are set for the Excel API's. See the blog link below.
    Steps :
    All your files in the machine running the WAS will be created in the default location
    Alias : webdynpro/resources
    Path : <Drive>:/usr/sap/J2E/JC00/j2ee/cluster/server0/temp/webdynpro/web
    You can open your Visual Administrator and go to HTTP provider service and then create your own Alias. say
    Alias : myAlias
    Path : <Drive>:/mydirectory/myfiles
    Once this is done restart your WebAS.
    The code explained will perform the following.
    There is a button UI element and a Download UI element. On click of the Action associated with the button ui element
    The code below will create a excel file in the location mentioned.
    On click of the download UI element you can view the excel file that was created.
    Now create a New project in your NWDS
    Follow the blog for importing the necessary jar files for Excel
    /people/perumal.kanthan/blog/2005/03/21/reading-excel-data-from-java-using-hssf-api
    Once that is done you can create say a button in your Webdynpro and associate it with a action.
    Then you can write some code like the one below.
    //Declare this in the end between the Begin others block.
      private FileOutputStream out = null;
      private HSSFWorkbook workBook = null;
      private HSSFSheet hsSheet = null;
      private HSSFRow row = null;
      private HSSFCell cell = null;
      private HSSFCellStyle cs = null;
      private HSSFCellStyle cs1 = null;
      private HSSFCellStyle cs2 = null;
      private HSSFDataFormat dataFormat = null;
      private HSSFFont f = null;
      private HSSFFont f1 = null;
    //Code to create the Excel.
      public void onActionExportToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionExportToExcel(ServerEvent)
        try
          out = new FileOutputStream("C:/mydirectory/myfiles/testexcel.xls");
          workBook = new HSSFWorkbook();
          hsSheet = workBook.createSheet("My Sheet");
          cs = workBook.createCellStyle();
          cs1 = workBook.createCellStyle();
          cs2 = workBook.createCellStyle();
          dataFormat = workBook.createDataFormat();
          f =  workBook.createFont();
          f1 = workBook.createFont();
           f.setFontHeightInPoints((short) 12);
    //          make it blue
           f.setColor( (short)HSSFFont.COLOR_NORMAL );
    //           make it bold
    //          arial is the default font
           f.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    //          set font 2 to 10 point type
           f1.setFontHeightInPoints((short) 10);
    //          make it red
           f1.setColor( (short)HSSFFont.COLOR_RED );
    //          make it bold
           f1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
          f1.setStrikeout(true);
          cs.setFont(f);
          cs.setDataFormat(dataFormat.getFormat("#,##0.0"));
    //       set a thick border
         cs2.setBorderBottom(cs2.BORDER_THICK);
    //       fill w fg fill color
         cs2.setFillPattern((short) HSSFCellStyle.SOLID_FOREGROUND);
        cs2.setFillBackgroundColor((short)HSSFCellStyle.SOLID_FOREGROUND);
    //       set the cell format to text see HSSFDataFormat for a full list
         cs2.setDataFormat(HSSFDataFormat.getBuiltinFormat("text"));
         cs2.setFont(f1);
         cs2.setLocked(true);
         cs2.setWrapText(true);
         row = hsSheet.createRow(0);
         hsSheet.createFreezePane(0,1,1,1);
        for(int i=1; i<10;i++)
           cell = row.createCell((short)i);
          cell.setCellValue("Excel Column "+i);
          cell.setCellStyle(cs2);
         workBook.write(out);
         out.close();
    //Read the file that was created.
         FileInputStream fin = new FileInputStream("C:/mydirectory/myfiles/testexcel.xls");
         byte b[] = new byte[fin.available()];
         fin.read(b,0,b.length);
         fin.close();
         wdContext.currentContextElement().setDataContent(b);
        catch(Exception e)
          wdComponentAPI.getComponent().getMessageManager().reportException("Exception while reading file "+e,true);  
        //@@end
    You can now add a Download UI Element to the layout.
    Create a Context Attribute say "dataContent" and this should be of Type Binary.
    The Data property of the File UI download element should be mapped to dataContent.
    In the init method write code like
    This is done for the download element.
         IWDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute("dataContent");   
         IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attInfo.getModifiableSimpleType();
    //In addition the FileDownload UI element needs for defined resource types  
         binaryType.setFileName("testexcel.xls");
         binaryType.setMimeType(WDWebResourceType.XLS);
    Hope that helps you. Anyway its a sample and it should be helpful for you to see how you can modify it and of course maintain some standards in coding unlike the test sample given above :).
    Let me know if you require further clarifications
    regards
    ravi

  • How to export data from a Dynpro table to Excel file?

    Hi
    Here I go again. I read the post <b>Looking for example to export data from a DynPro table to Excel file</b> and put the code lines into a Web Dynpro Project where we need to export a dynpro table to Excel file but exactly at line 23 it doesn't recognize <b>workBook = new HSSFWorkbook();</b>
    1     //Declare this in the end between the Begin others block.
    2     
    3     private FileOutputStream out = null;
    4     private HSSFWorkbook workBook = null;
    5     private HSSFSheet hsSheet = null;
    6     private HSSFRow row = null;
    7     private HSSFCell cell = null;
    8     private HSSFCellStyle cs = null;
    9     private HSSFCellStyle cs1 = null;
    10     private HSSFCellStyle cs2 = null;
    11     private HSSFDataFormat dataFormat = null;
    12     private HSSFFont f = null;
    13     private HSSFFont f1 = null;
    14     
    15     //Code to create the Excel.
    16     
    17     public void onActionExportToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
    18     {
    19     //@@begin onActionExportToExcel(ServerEvent)
    20     try
    21     {
    22     out = new FileOutputStream("C:/mydirectory/myfiles/testexcel.xls");
    23     workBook = new HSSFWorkbook();
    24     hsSheet = workBook.createSheet("My Sheet");
    25     cs = workBook.createCellStyle();
    26     cs1 = workBook.createCellStyle();
    27     cs2 = workBook.createCellStyle();
    28     dataFormat = workBook.createDataFormat();
    29     f = workBook.createFont();
    30     f1 = workBook.createFont();
    31     f.setFontHeightInPoints((short) 12);
    32     // make it blue
    33     f.setColor( (short)HSSFFont.COLOR_NORMAL );
    34     // make it bold
    35     // arial is the default font
    36     f.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    37     
    38     // set font 2 to 10 point type
    39     f1.setFontHeightInPoints((short) 10);
    40     // make it red
    41     f1.setColor( (short)HSSFFont.COLOR_RED );
    42     // make it bold
    43     f1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    44     f1.setStrikeout(true);
    45     cs.setFont(f);
    46     cs.setDataFormat(dataFormat.getFormat("#,##0.0"));
    47     
    48     // set a thick border
    49     cs2.setBorderBottom(cs2.BORDER_THICK);
    50     
    51     // fill w fg fill color
    52     cs2.setFillPattern((short) HSSFCellStyle.SOLID_FOREGROUND);
    53     cs2.setFillBackgroundColor((short)HSSFCellStyle.SOLID_FOREGROUND);
    54     // set the cell format to text see HSSFDataFormat for a full list
    55     cs2.setDataFormat(HSSFDataFormat.getBuiltinFormat("text"));
    56     cs2.setFont(f1);
    57     cs2.setLocked(true);
    58     cs2.setWrapText(true);
    59     row = hsSheet.createRow(0);
    60     hsSheet.createFreezePane(0,1,1,1);
    61     for(int i=1; i<10;i++)
    62     {
    63     cell = row.createCell((short)i);
    64     cell.setCellValue("Excel Column "+i);
    65     cell.setCellStyle(cs2);
    66     }
    67     workBook.write(out);
    68     out.close();
    69     
    70     //Read the file that was created.
    71     
    72     FileInputStream fin = new FileInputStream("C:/mydirectory/myfiles/testexcel.xls");
    73     byte b[] = new byte[fin.available()];
    74     fin.read(b,0,b.length);
    75     fin.close();
    76     
    77     wdContext.currentContextElement().setDataContent(b);
    78     }
    79     catch(Exception e)
    80     {
    81     wdComponentAPI.getComponent().getMessageManager().reportException("Exception while reading file "+e,true);
    82     }
    83     //@@end
    84     }
    I don't know why this happen? Any information I will appreciate it.
    Thanks in advance!!!
    Tokio Franco Chang

    After test the code lines appears this error stacktrace:
    [code]
    java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook
         at com.sap.tc.webdynpro.progmodel.api.iwdcustomevent.ExportToExcel.onActionAct1(ExportToExcel.java:232)
         at com.sap.tc.webdynpro.progmodel.api.iwdcustomevent.wdp.InternalExportToExcel.wdInvokeEventHandler(InternalExportToExcel.java:147)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
         at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:101)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:304)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:649)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
         at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:252)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:392)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:159)
    Thanks in advance!!!
    Tokio Franco Chang
    [/code]

  • Issue to export data from sql to excel

    I have MS SQL 2008 Developer version and visual studio 2008. I'm using SSIS Import and Export Wizard on the VS2008 to create a simple package to export data from a table using a sql query to excel file (.xlsx), but I got the following
    error messages:
    [Destination - Query [37]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E21.
    [Destination - Query [37]] Error: Cannot create an OLE DB accessor. Verify that the column metadata is valid.
    [SSIS.Pipeline] Error: component "Destination - Query" (37) failed the pre-execute phase and returned error code 0xC0202025.
    The SQL query is
    SELECT [BusinessEntityID]
          ,[PersonType]
          ,[NameStyle]
          ,[Title]
          ,[FirstName]
          ,[MiddleName]
          ,[LastName]
      FROM [AdventureWorks2008].[Person].[Person]
    Any help will be appreciated. Thanks.
    A Fan of SSIS, SSRS and SSAS

    Or another way is to save the package created by Export Import wizard, open it in BIDS and add a Derived column task before the Excel destination to do explicit casting of the columns to your required unicode datatypes.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

Maybe you are looking for

  • SOLUTION... Error updating iPod Touch with 64-bit Vista

    For the last two years... I have had a horrible time updating my iPod, beginning around iTunes 7. I am running 64-bit Windows Vista and I have had trouble with the 1st Gen, 3rd Gen and 4th Gen Touches. Everytime I would attempt to upgrade it would se

  • Using the Document Manager Rich Text Editor

    I'm wondering whether there is a reasonable way we can use the Rich Text Editor (based on CKEditor) that is contained within the Document Manager task flow (primarily for editing Wiki pages) outside of the Document Manager itself? We have another typ

  • How-to: Installing Windows XP on Qosmio X300

    Admins: please review this content, and make this topic sticky. I decided to try out Windows XP on my Qosmio X300-130 laptop, that came with Windows Vista 32-bit pre-installed. I bought XP Pro license + disc. Part A: Installation =============== 1. G

  • How can I load data with Scripts on *FDM* to a HFM target System????

    Hi all! I need help because I can´t find a good guide about scripting on FDM. The problem I have is the next one. I have on mind to load my data with data load file in FDM to a HFM target system, but I would like to load an additional data using an e

  • Not able to connect the internet through OVI

    Sir I tried to connect to the internet through OVI.  But I am not getting.  Please tell a solution.  Screen shot is attached. Phone C6-00 Solved! Go to Solution. Attachments: nokia.docx ‏270 KB