.txt to .xls

hi guys,
can anyone let me know how to convert .txt to .xls
Thanks alot in advanse
Naveen

Hi
By SAP?
I suppose the easier way is to create a text file in CSV format.
Max

Similar Messages

  • Read spool data and send it through e-mail as .txt or .xls attachment

    Hi All,
    I have to read the spool data and send it via e-mail as .txt or .xls attachment. I have used FMs LIST_TO_ASCI, RSPO_RETURN_SPOOLJOB and SO_SOLITAB_TO_SOLIXTAB. I am using FM SO_DOCUMENT_SEND_API1 to send e-mail.
    My problem is, the text file being sent is not showing entire data. It's getting truncated after 255 characters. Is this a standard? If yes, then is there any work around for it?
    Alternatively, I can send the file as excel attachment. How can this be done?
    Thanks,
    Ashwini

    You will have to convert string to Xstring and then to binary to acheive this.
    Check this wiki to send a mail attachment with more than 255 characters.
    [https://wiki.sdn.sap.com/wiki/display/Snippets/Tosendamailattachmentwithmorethan255charactersinaline]
    Vikranth

  • Outline Load Utility using .txt or .xls file

    Dear All,
    I need to load some field that have a local language (e.g : thailand language). As I know, .csv is not support the unicode.
    So, Can we load the data using outline load utility in planning using .txt or .xls file..?? or it's for .csv only?
    Thanks.
    Regards,
    VieN

    Hi Alp,
    thanks for reply.
    The case is like this.
    for example :
    - in .xls file show the data like this Pick up Hilux Vigo C-Cab 2.5J ดีเซล สีขาว
    - but in the .csv file show the data like this Pick up Hilux Vigo C-Cab 2.5J (??????????)
    And I need load the data like the .xls one (format : Pick up Hilux Vigo C-Cab 2.5J ดีเซล สีขาว).
    so, any idea how to load the data using Load data utility?
    thanks.
    Regards,
    VieN

  • Automatische Übernahme von Daten aus einer txt oder xls-Datei in ein pdf Formular

    Hallo zusammen,
    ich würde gerne automatisch Daten aus einer txt-Datei oder einer xls-Datei in ein pdf Formular übernehmen (z.B. Namen, Geburtsdatum).
    Die Daten sollen in Zeugnisformulare einer Schule übernommen werden, so dass alle Lehrerinnen und Lehrer diese Daten nicht mehr manuell eingeben müssen. Das Schulstatistik Programm exportiert die Schülerdaten eben in eine txt oder xls-Datei.
    Wie ist das möglich und wie muss ich hierfür die Einstellungen bei den Formularfeldern wählren?
    Vielen Dank für eure Antwort!

    Füll doch ein Formular aus, exportier die Daten als XFDF.
    Lies aus, wie das formatiert sein muss.
    Formatiere Deine Daten ebenso.
    Importiere dann diese Daten.

  • Need procedure -Load txt,csv,xls pdf file to db

    Could you please share me the procedure for loading the csv,xls,txt,pdf files into oracle database

    1008783 wrote:
    Could you please share me the procedure for loading the csv,xls,txt,pdf files into oracle databaseThere isn't any one particular procedure for doing it.
    The FAQ has some links to information relating to Excel files and CSV files (See: {message:id=9360007})
    As for TXT files, that depends what the contents are and what you are intending to do with them, though if you need some general access to a text file (that isn't structured like CSV) then you'd probably use the UTL_FILE package "line by line" or "chunk by chunk" or read the text file directly into a CLOB and process it there.
    As for PDF files, these are considered binary files, so you would typically store them in the database as a BLOB datatype and load them in a similar way to CLOB's using the BFILE method.
    But before we give you any specific answers, it's better if you explain exactly what it is you are trying to achieve.
    And read the FAQ on asking questions: {message:id=9360002}

  • Convert file  TXT to XLS.

    Hello
    I have txt file on the WAS . I need the same  file on the my PC but as XLS ( excel file )
    Does anyone know how to do it.
    Thank you
    Krsto
    Edited by: Krsto Gjergja on Apr 8, 2008 1:26 PM
    Edited by: Krsto Gjergja on Apr 8, 2008 1:45 PM

    hi,
    Use data set statements to open and read that file contents in to an internal table.
    Now use FM EXCEL_OLE_STANDARD_DAT – Starts Excel and transfers internal table data
    OR
    RH_START_EXCEL_WITH_DATA – Starts Excel with contents of an internal table
    OR
    SAP_CONVERT_TO_XLS_FORMAT – Downloads internal table to Excel
    This FM 's will help you download the file in excel format on you desktop.
    Hope this works, Do reward.

  • Editing an example VI to include saving to txt or xls files

    Hi,
    I'm a very new Labview user, and im looking at recording temperatures with thermocouples. i can use the example VI for data acquisition and all, but it doesnt save my data to a spreadsheet or text file or anything. how can i edit it so that it does? after looking around, i gave it a shot, but it doesnt work - it seems to just save the initial values for each TC. 
    i've attached my VI.
    cheers 
    Attachments:
    Bart.vi ‏31 KB

    hope this helps:
    I think you should send the data to a text file.
    Message Edited by Harold Timmis on 10-17-2009 04:04 AM
    Harold Timmis
    [email protected]
    Orlando,Fl
    *Kudos always welcome
    Attachments:
    test.txt ‏1 KB
    sendingtofileevent.vi ‏11 KB

  • Need report output same as its show in the previewer in the (.txt and .xls) format

    I need an output file(in text and excel format) generated from the report builder exactly in same format as it shows in the Report previewer.
    it should include all the labels as well as the data.
    Thanx in advance
    Reply ASAP
    From
    Dharmendra

    Hi Dharam
    You can create text file output as seen on Live Previewer by generating to Text (File->Generate to File->Text). Ensure that you run Builder with the following command line parameter:
    MODE=CHARACTER
    If the Builder mode is not character (BITMAP), it will generate PostScript file if you do a File->Generate to File->Text.
    You can create Excel format output from Reports with Delimited output (File->Generate to File->Delimited). In the ensuing dialog box, choose comma (,) as the delimiter to obtain a CSV file. Export this file in Excel.
    Regards
    The Oracle Reports Team

  • Searching for ABAP to download BW Process Chain (as txt / xls)

    Dear all,
    Has somebody an ABAP to download BW Process Chain definitions as a TXT or XLS file (to local PC)?
    (and want's to share it...
    Best regards,
    Jos

    Hello Jos,
    i can just give you a hint on some tables:
    RSPCLOGCHAIN contains the LOG_IDs of all process chains executed.
    RSPCPROCESSLOG contains the steps executed in the given run of the prcess chain identified by LOG_ID.
    perhaps, that helps at least a little bit...
    MIKE

  • How do I use the filter to automatically print email and .pdf, .xls, .doc attachments to my default network printer and to other network printers

    I receive sales orders by email. I want to filter some to print on my default network printer and others to print on another network printer. The email body must print as well as txt, .pdf, .xls, .doc attachments.

    You can filter messages to file them to a certain folder, but I don't think you can have Thunderbird to automatically print them.

  • How to send a mail as .txt attachment ?

    Hi all,
    I got a requirement to write code for sending mail in oops.
    i have written code for .xls which is working fine. But requirement is to send the mail in the format of txt.
    i just only chnge the .xls to .txt where i can see the output properly in sap but problem is that i am unable to get the proper alignment. when i execute the report and see the output in sost i can see the attachment.i am downloading the attachment there only(Our server is not configured to get the mails directly) .So when i open the saved text file on my pc the output is appearing as follows...
    pernr nachn vorna
            0001 L0001 F0001
                0002 L0002 F0002
                   0003 L0003 F0003
                         0004 L0004 F0004...
    Where it should come in straight line as follows in my o/p code..
    pernr nachn vorna
    0001 L0001 F0001
    0002 L0002 F0002
    0003 L0003 F0003
    0004 L0004 F0004...
    i am puttin g my code ..please correct me where i am wrong .....waiting for your valuabel inputs..
    *& Report  ZGBTEST02
    REPORT  YSAS_MAIL2.
    *Changes done by sas
    *PARAMETERS: P_MAIL TYPE AD_SMTPADR OBLIGATORY, " G C by sas
    *P_MAIL1 TYPE AD_SMTPADR OBLIGATORY." G by sas
    TABLES: ADR6.
    SELECT-OPTIONS:P_EADDR FOR ADR6-SMTP_ADDR NO INTERVALS .
    *end of changes by sas
    DATA: I_GLT0 TYPE STANDARD TABLE OF GLT0.
    *DATA: I_pernr  TYPE STANDARD TABLE OF pa0002.  " MARA Entries
    DATA: BEGIN OF I_PERNR OCCURS 1 ,
    PERNR TYPE PA0002-PERNR,
    NACHN TYPE PA0002-NACHN,
    VORNA TYPE PA0002-VORNA,
    END OF I_PERNR..
    *      I_MARC  TYPE STANDARD TABLE OF MARC.  " MARC Entries
    DATA: L_TEXT  TYPE CHAR255.  " Text
    DATA: L_LINES TYPE I,
          L_SIZE  TYPE SOOD-OBJLEN.
    " Size of Attachment
    * Mail related
    DATA: I_CONTENT         TYPE   SOLI_TAB, " Mail content
          I_ATTACH          TYPE   SOLI_TAB, " Attachment
          I_ATTACH1         TYPE   SOLIX_TAB. " Attachment
    DATA: L_SEND_REQUEST    TYPE REF TO    CL_BCS,
                                                " E-Mail Send Request
          L_DOCUMENT        TYPE REF TO    CL_DOCUMENT_BCS,
                                                " E-Mail Attachment
          L_RECIPIENT       TYPE REF TO    IF_RECIPIENT_BCS,
                                                " Distribution List
          L_SENDER          TYPE REF TO    IF_SENDER_BCS,
                                                " Address of Sender
          L_UNAME           TYPE           SALRTDRCPT,
                                                " Sender Name(SY-UNAME)
          L_BCS_EXCEPTION   TYPE REF TO    CX_DOCUMENT_BCS,
                                                " BCS Exception
          L_ADDR_EXCEPTION  TYPE REF TO    CX_ADDRESS_BCS,
                                                " Address Exception
          L_SEND_EXCEPTION  TYPE REF TO    CX_SEND_REQ_BCS.
    " E-Mail sending Exception
    *Constants------------------------------------------------------------*
    CONSTANTS: C_TAB(1) TYPE C VALUE
               CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
                                         " Tab Character
               C_CR(1)  TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF,
                                         " Line Feed for End-Of_line
               C_EXT    TYPE SOODK-OBJTP VALUE 'TXT'. " XLS Extension
    START-OF-SELECTION.
      SELECT PERNR NACHN VORNA  FROM PA0002 INTO CORRESPONDING FIELDS OF TABLE I_PERNR UP TO 20 ROWS.
    *select * from glt0 into table i_glt0.
    * Preparing body of the Mail
    *  MOVE 'SAP Material Master Records' TO L_TEXT.
    *  APPEND L_TEXT TO I_CONTENT.
    *  CLEAR L_TEXT.
    *  APPEND L_TEXT TO I_CONTENT.
    *  MOVE 'Thanks,' TO L_TEXT.
    *  APPEND L_TEXT TO I_CONTENT.
    *  MOVE 'SAP MM' TO L_TEXT.
    *  APPEND L_TEXT TO I_CONTENT.
      MOVE '<BR>Attached is your HRIS report(s) generated from the Firm''s' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
      MOVE ' Human Resources  Information System (SAP).' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
      MOVE '<BR>  ' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
      MOVE '<BR>This is an automated report.' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
    *        MOVE '<BR>  ' TO l_text.
    *        APPEND l_text TO i_content.
      MOVE '<BR>  ' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
    *        MOVE '<BR>Please do not reply to this email' TO l_text.
    *        APPEND l_text TO i_content.
    *        MOVE '<BR>  ' TO l_text.
    *        APPEND l_text TO i_content.
      MOVE '<BR>Thank you.' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
    * Creates persistent send request
      TRY.
          L_SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
    * Creating Document
          L_DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
                                        I_TYPE  = 'RAW'
                                        I_TEXT  = I_CONTENT[]
                                        I_SUBJECT = 'Automated HRIS (SAP) Report' ).
    DATA: W_PERNR LIKE I_PERNR.
    * Preparing contents of attachment with Change Log
          PERFORM PREPARE_ATTACHMENT.
          DATA: compressed like solisti1 occurs 10 with header line.
    DATA: decompressed like solisti1 occurs 10 with header line.
          CALL FUNCTION 'TABLE_COMPRESS'
    *   IMPORTING
    *     COMPRESSED_SIZE       =
                        TABLES
    *      in                    = eerec
                          in                    = i_attach
                          out                   = compressed.
          CALL FUNCTION 'TABLE_DECOMPRESS'
            TABLES
              in  = compressed
              out = decompressed.
          DESCRIBE TABLE decompressed LINES L_LINES.
    * Size to multiplied by 2 for UNICODE enabled systems
          L_SIZE = L_LINES * 2 * 255.
    * Adding Attachment
          CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
            EXPORTING
              I_ATTACHMENT_TYPE    = C_EXT
              I_ATTACHMENT_SIZE    = L_SIZE
              I_ATTACHMENT_SUBJECT = 'Hr Details'
    *          i_att_content_hex    = i_attach[].
              I_ATT_CONTENT_TEXT   = decompressed[].
    *      DESCRIBE TABLE I_MARC LINES L_LINES.
    * Size to multiplied by 2 for UNICODE enabled systems
    *      L_SIZE = L_LINES * 2 * 255.
    ** Adding Attachment
    *      CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
    *        EXPORTING
    *          I_ATTACHMENT_TYPE    = C_EXT
    *          I_ATTACHMENT_SIZE    = L_SIZE
    *          I_ATTACHMENT_SUBJECT = 'MARC Details'
    *          I_ATT_CONTENT_HEX    = I_ATTACH1[].
    **          i_att_content_text   = i_attach1[].
    * Add document to send request
          CALL METHOD L_SEND_REQUEST->SET_DOCUMENT( L_DOCUMENT ).
          DATA:LR_SENDER TYPE REF TO IF_SENDER_BCS,
               LR_SEND TYPE REF TO CL_BCS.
    * Preparing the sender object
    *      LR_SENDER = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( sy-uname ).
          DATA: L1_UNAME TYPE SY-UNAME.
          L1_UNAME = SY-UNAME.
          LR_SENDER = CL_SAPUSER_BCS=>CREATE( L1_UNAME ).
    * Setting the sender
          CALL METHOD L_SEND_REQUEST->SET_SENDER
            EXPORTING
              I_SENDER = LR_SENDER.
    * E-Mail
          LOOP AT P_EADDR.
            TRANSLATE P_EADDR-LOW TO LOWER CASE.
            L_RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( P_EADDR-LOW ).
            CALL METHOD L_SEND_REQUEST->ADD_RECIPIENT
              EXPORTING
                I_RECIPIENT  = L_RECIPIENT
                I_EXPRESS    = 'U'
                I_COPY       = ' '
                I_BLIND_COPY = ' '
                I_NO_FORWARD = ' '.
            IF SY-SUBRC EQ 0.
              WRITE:/'** SUCCESS:  Email Sent to', P_EADDR-LOW COLOR COL_NORMAL.
            ELSE.
              WRITE:/'** ERROR: Failed to send Email to',P_EADDR-LOW COLOR COL_NEGATIVE .
            ENDIF.
          ENDLOOP.
    *Trigger E-Mail immediately
          L_SEND_REQUEST->SET_SEND_IMMEDIATELY( ' ' ).
          CALL METHOD L_SEND_REQUEST->SEND( ).
          COMMIT WORK.
        CATCH CX_DOCUMENT_BCS INTO L_BCS_EXCEPTION.
        CATCH CX_SEND_REQ_BCS INTO L_SEND_EXCEPTION.
        CATCH CX_ADDRESS_BCS  INTO L_ADDR_EXCEPTION.
      ENDTRY.
    *&      Form  PREPARE_ATTACHMENT
    FORM PREPARE_ATTACHMENT .
      FIELD-SYMBOLS: <LFS_TABLE>,    " Internal table structure
                     <LFS_CON>.      " Field Content
      DATA: L_TEXT TYPE CHAR1024.     " Text content for mail attachment
      DATA: L_CON TYPE STRING. "(50) TYPE c.        " Field Content in character format
      DATA: L_STR TYPE STRING,
            L_STR1 TYPE STRING.
    *data: w_pernr type TABLE OF I_PERNR.
      DATA: LS_SOLIX TYPE SOLIX.
    *  CONCATENATE 'PERNR' 'FIRST NAME' 'Last Name' C_CR INTO L_TEXT SEPARATED BY '|'.
    *  append l_text to i_attach.
    *  clear l_text.
    * Columns to be tab delimeted
      LOOP AT I_PERNR ASSIGNING <LFS_TABLE>.
        DO.
          ASSIGN COMPONENT SY-INDEX OF STRUCTURE <LFS_TABLE>
                 TO <LFS_CON>.
          IF SY-SUBRC NE 0.
            CONCATENATE C_CR L_TEXT INTO L_TEXT.
    *        CONCATENATE l_str c_cr l_text INTO l_str.
    *        ls_solix-line = l_text.
    *        APPEND ls_solix TO i_attach.
            APPEND L_TEXT TO I_ATTACH.
            EXIT.
          ELSE.
            CLEAR: L_CON.
            MOVE <LFS_CON> TO L_CON.
            CONDENSE L_CON.
            IF SY-INDEX = 1.
              CLEAR: L_TEXT.
              MOVE L_CON TO L_TEXT.
            ELSE.
              CONCATENATE L_TEXT L_CON INTO L_TEXT
                 SEPARATED BY C_TAB.
            ENDIF.
          ENDIF.
        ENDDO.
      ENDLOOP.
    *  i_attach1[] = i_attach[].
    ENDFORM.                    " PREPARE_ATTACHMENT
    Please if any one having 6.0 version please upload it and see..
    Regards
    Sas

    Hi ,
    Did you downloaded from  SOST  using the display icon and inside that 4th tab for attachment ....
    and see?
    Regards
    sas
    pS: THE FIRST page is not allowing the spaces in sdn...
    i am getting o/p as
    pernr vochn norna
    .........0001 f0001 l0001
    .................0002 F0002 L0002
    .......................0003 F0003 L0003.....
    Please remove dots and understand that is the o/p i am getting in my presenation file
    i just expecting the o/p as told earlier..
    Regards
    sas

  • Initially I had downloaded Document 2 (Free) application to view my doc, ppt and xls files. I was not able to edit the files so there was an option for upgrade the Document-2 free to paid version. I have upgraded the Document 2 application.

    Initially I had downloaded Document 2 (Free) application to view my doc, ppt and xls files. I was not able to edit the files so there was an option for upgrade the Document-2 free to paid version. I have upgraded the Document 2 application. But on my iPad now there are to application present Docemnt-2 (Free) and Document-2. I am not able to open any existing document using the upgraded version of application. How do I connect all the existing txt,PPT,XLS doccument to the new upgraded Document-2 application and then to edit it on my iPad.

    As suggested I had deleted the free application and did a hard restart the iPad. I have again copied the document using iTunes. But I am not able to edit any document using this app. Document 2 (paid version) supports editing features of the txt/ xls /ppt files. Is there any problem while loading the Document 2 app. If I reload then do I need to purchase again?

  • Include txt file (containing email addresses) as option to name in "To" to enable send email to many recipients individually

    Thunderbird can be made into a good mass mailing software by having the option of allowing a txt file name in the "To" field. The software then picks up each email address in the txt file and sends the email to each email address individually.
    Most people keep a list of 100 or 200 or so emails to whom they send regular emails as a txt or xls file. This feature will help enable people use Thunderbird as the mass mailer and send emails to email addresses in a txt or xls file
    Mass mailing softwares usually cost about $ 50 and this feature will save people this money.
    Regards

    ''mahesh534 [[#question-1048348|said]]''
    <blockquote>
    Thunderbird can be made into a good mass mailing software by having the option of allowing a txt file name in the "To" field. The software then picks up each email address in the txt file and sends the email to each email address individually.
    Most people keep a list of 100 or 200 or so emails to whom they send regular emails as a txt or xls file. This feature will help enable people use Thunderbird as the mass mailer and send emails to email addresses in a txt or xls file
    Mass mailing softwares usually cost about $ 50 and this feature will save people this money.
    Regards
    </blockquote>

  • Implementing dowload files - Problem with excel (xls)

    Hello
    I've a strange problem.
    I displaying a directory listing to the user. The user selects a file to be downloaded. The files are of diff formats - txt, csv, xls, pdf, zip
    The download works for pdf, txt but for XLS, when I save the file, its has junk.
    Any pointer ???
    ----------------Attached source. It is part of JSP not a servlet
    String _fileLocation = "C:/test.xls";
    String _fileName = "ttt.XLS";
    String _fileType = "application/vnd.ms-excel";
    BufferedInputStream bufferedInputStream = null;
    File inputFile = new java.io.File(_fileLocation);
    int fileSize = (int) inputFile.length();
    System.out.println("fileLocation");
    System.out.println(_fileLocation);
    System.out.println("fileSize");
    System.out.println(fileSize);
    if (fileSize > 0)
    FileInputStream fis = new FileInputStream(inputFile);
    bufferedInputStream =
    new BufferedInputStream(new FileInputStream(inputFile));
    byte[] fByte = new byte[fileSize];
    if (fis.read(fByte, 0, fileSize) >= 0)
    //Committing the
    response.setContentType(_fileType);
    //response.setContentLength(fByte.length);
    response.setHeader(
    "Content-Disposition",
    "attachment; filename="+ _fileName);
    response.getOutputStream().write(fByte);
    response.getOutputStream().flush();
    response.getOutputStream().close();
    fis.close();
    else
    System.out.println("The report file is empty");
    Thanks for help
    [ December 03, 2003: Messa                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Added a single line, response.reset()
    This takes away any preexisting chars/junk .
    It works!

  • How to download a text, bat, excel file from a page

    Hi All,
    I have written a jsp code that will list all the present in a particular folder. Those are displayed as links and on click, I want to download the file (pop-up message with the option to open or save it)...
    But this is working properly for files like .exe, .pdf, .so etc. But when I am trying to download a .txt, .dat, .xls or .jpg (even .bat or .zip) files, it's getting opened in the same browser (files like .doc, .xls or .zip are opening in unreadable format). Even if, I right click on the link and click on 'Save Target As...', the file is getting saved as .html format.
    I am attaching the jsp code:
    <%@ page import = "java.io.File"%>
    <h3><u>Right-click on the link and select 'Save Target As...' to download</u></h3>
    <%
         String directory = "C:/My Drive/my_context/my testings/file upload 2/files/";
         File file = new File(directory);
         File[] content = file.listFiles();
         for (int i=0; i<content.length; i++)
    %>
              <a href="./files/<%=content.getName()%>"><%=content[i].getName()%></a>
              <br>
    <%
    %>
    <br><br>
    BACK
    But I don't think that there is anything to do with the code. Can anybody help me on this.
    Thanks in Advance,
    Ujjal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi All,
    I have written a jsp code that will list all the present in a particular folder. Those are displayed as links and on click, I want to download the file (pop-up message with the option to open or save it)...
    But this is working properly for files like .exe, .pdf, .so etc. But when I am trying to download a .txt, .dat, .xls or .jpg (even .bat or .zip) files, it's getting opened in the same browser (files like .doc, .xls or .zip are opening in unreadable format). Even if, I right click on the link and click on 'Save Target As...', the file is getting saved as .html format.
    I am attaching the jsp code:
    <%@ page import = "java.io.File"%>
    <h3><u>Right-click on the link and select 'Save Target As...' to download</u></h3>
    <%
         String directory = "C:/My Drive/my_context/my testings/file upload 2/files/";
         File file = new File(directory);
         File[] content = file.listFiles();
         for (int i=0; i<content.length; i++)
    %>
              <a href="./files/<%=content.getName()%>"><%=content[i].getName()%></a>
              <br>
    <%
    %>
    <br><br>
    BACK
    But I don't think that there is anything to do with the code. Can anybody help me on this.
    Thanks in Advance,
    Ujjal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for