Re: problem in reading doc file

if(fileName.endsWith(".doc"))
outToClient.writeBytes("Centent-Type: application/msword\r\n"); !?

There are no such methods in the JDK. Your question is therefore off topic. Evidently you are using some 3rd party Java Excel API. Ask them. Locking.

Similar Messages

  • Reading .doc files on a mac

    I transferred my old PC Windows .doc files from my PC to an external hard drive but they will not open on a mac, the page is blank. Can I change the file extension to read them or do I have to use a program?

    TextEdit has no problems with any .doc files I have thrown at it. Because most word processors are more sophisticated than TextEdit, there may be formatting it has trouble reproducing, but I haven't had that issue. It certainly opens much faster than Word or even NeoOffice, which I also use, when you need a quick peek or read through. It also can save a document in Word format.

  • Problem While reading a file in text mode from Unix in ECC 5.0

    Hi Experts,
    I am working on Unicode Upgrade project of ECC5.0.
    Here i got a problem with reading a file format which it does successfully in 4.6 and not in ECC5.0
    My file format was as follows:
    *4 000001862004060300000010###/#######L##########G/##########G/########
    It was successfully converting corresponding field values in 4.6:
    *4
    00000186
    2004
    06
    03
    00000010
    25
    0
    4
    0
    54.75
    0
    54.75
    0.00
    While i am getting some problem in ECC5.0 during conversion of the above line:
    *4 000001862004060300000010###/#######L##########G/##########G/########
    it was consider in the same # values.
    I have used the following statement to open and read dataset.
    OPEN DATASET i_dsn IN LEGACY TEXT MODE FOR INPUT.
    READ DATASET i_dsn INTO pos_rec.
    Thanks for your help.
    Regards,
    Gopinath Addepalli.

    Hi
          You might be facing this problem because of uni code. So while opening or reading the file, there is a statement call ENCODING. Use that option and keep the code page which you want. Then the problem may be solved.
    Thanks & Regards.
    Harish.

  • Problem  while reading XML file from Aplication server(Al11)

    Hi Experts
    I am facing a problem while  reading XML file from Aplication server  using open data set.
    OPEN DATASET v_dsn IN BINARY MODE FOR INPUT.
    IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      READ DATASET v_dsn INTO v_rec.
    WHILE sy-subrc <> 0.
      ENDWHILE.
      CLOSE DATASET v_dsn.
    The XML file contains the details from an IDOC number  ,  the expected output  is XML file giving  all the segments details in a single page and send the user in lotus note as an attachment, But in the  present  output  after opening the attachment  i am getting a single XML file  which contains most of the segments ,but in the bottom part it is giving  the below error .
    - <E1EDT13 SEGMENT="1">
      <QUALF>001</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803<The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/SHPORD_0080005842.xml'.
    /SPAN></NTEND>
      <NTENZ>000000</NTENZ>
    for all the xml  its giving the error in bottom part ,  but once we open the source code and  if we saved  in system without changing anything the file giving the xml file without any error in that .
    could any one can help to solve this issue .

    Hi Oliver
    Thanx for your reply.
    see the latest output
    - <E1EDT13 SEGMENT="1">
      <QUALF>003</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803</NTEND>
      <NTENZ>000000</NTENZ>
      <ISDD>00000000</ISDD>
      <ISDZ>000000</ISDZ>
      <IEDD>00000000</IEDD>
      <IEDZ>000000</IEDZ>
      </E1EDT13>
    - <E1EDT13 SEGMENT="1">
      <QUALF>001</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803<The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/~1922011.xml'.
    /SPAN></NTEND>
      <NTENZ>000000</NTENZ>
    E1EDT13 with QUALF>003 and  <E1EDT13 SEGMENT="1">
    with   <QUALF>001 having almost same segment data . but  E1EDT13 with QUALF>003  is populating all segment data
    properly ,but E1EDT13 with QUALF>001  is giving in between.

  • Problem with reading config file

    Hello,
    I have problem with reading config file from the same dir as class is. Situation is:
    I have servlet which working with DB, and in confing file (config.pirms) are all info about connection (drivers, users, passw, etc.). Everything work fine if I hardcoded like:
    configFileName = "C:\\config.pirms";I need to avoid such hardcoding, I tryied to use:
    configFileName = Pirms.class.getClassLoader().getResourceAsStream ("/prj/config.pirms").toString();but it isn't work.
    My config file is in the same directory as Pirms.class (C:\apache-tomcat-5.5.17\webapps\ROOT\WEB-INF\classes\prj)
    Also I tryied BundledResources, it isn't work fo me also.
    Can anybody help me to solve this problem? with any examples or other stuff?
    Thanks in advance.
    Andrew

    Thanks, but I am getting error that "non-static method getServletConfig() cannot be referenced from a static context"
    Maybe is it possibility to use <init-param> into web.xml file like:
    <init-param>
      <param-name>configFile</param-name>
      <param-value>/prj/config.pirms</param-value>
    </init-param>If yes can anybody explain how to do that?
    I need to have that file for:
    FileReader readFile = new FileReader(configFile);Thanks in advance.

  • How to read doc file

    hi friends,
    i want to read doc file and write it into test file. is their any direct/indirect method for it. i have tried getByte() method but it also write some illigal character also.
    waiting for response.
    alok

                InputStream source = new FileInputStream("your doc file");
                OutputStream destination = new FileOutputStream("your file to write to");
                byte[] buffer = new byte[1024]; // or whatever size suits you
                for (int len = 0; (len = source.read(buffer)) >= 0;)
                    destination.write(buffer, 0, len);
                source.close();
                destination.close();
    [/cpde]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problems when reading pdf files

    I use windows 7, and also have available Adobe Reader 5 and Adobe Reader X, but i receive some problems when reading pdf files. What can I do???

    Reader 5 is not Windows Compatible. Two different versions of the same computer can cause all sorts of problems. Remove all Acrobat and/or Reader software then re-install Reader X.

  • Problems with reading XML files with ISO-8859-1 encoding

    Hi!
    I try to read a RSS file. The script below works with XML files with UTF-8 encoding but not ISO-8859-1. How to fix so it work with booth?
    Here's the code:
    import java.io.File;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import java.net.*;
    * @author gustav
    public class RSSDocument {
        /** Creates a new instance of RSSDocument */
        public RSSDocument(String inurl) {
            String url = new String(inurl);
            try{
                DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                Document doc = builder.parse(url);
                NodeList nodes = doc.getElementsByTagName("item");
                for (int i = 0; i < nodes.getLength(); i++) {
                    Element element = (Element) nodes.item(i);
                    NodeList title = element.getElementsByTagName("title");
                    Element line = (Element) title.item(0);
                    System.out.println("Title: " + getCharacterDataFromElement(line));
                    NodeList des = element.getElementsByTagName("description");
                    line = (Element) des.item(0);
                    System.out.println("Des: " + getCharacterDataFromElement(line));
            } catch (Exception e) {
                e.printStackTrace();
        public String getCharacterDataFromElement(Element e) {
            Node child = e.getFirstChild();
            if (child instanceof CharacterData) {
                CharacterData cd = (CharacterData) child;
                return cd.getData();
            return "?";
    }And here's the error message:
    org.xml.sax.SAXParseException: Teckenkonverteringsfel: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (radnumret kan vara f�r l�gt).
        at org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
        at org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1072)
        at org.apache.crimson.parser.InputEntity.isXmlDeclOrTextDeclPrefix(InputEntity.java:914)
        at org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:1183)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:653)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
        at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
        at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
        at getrss.RSSDocument.<init>(RSSDocument.java:25)
        at getrss.Main.main(Main.java:25)

    I read files from the web, but there is a XML tag
    with the encoding attribute in the RSS file.If you are quite sure that you have an encoding attribute set to ISO-8859-1 then I expect that your RSS file has non-ISO-8859-1 character though I thought all bytes -128 to 127 were valid ISO-8859-1 characters!
    Many years ago I had a problem with an XML file with invalid characters. I wrote a simple filter (using FilterInputStream) that made sure that all the byes it processed were ASCII. My problem turned out to be characters with value zero which the Microsoft XML parser failed to process. It put the parser in an infinite loop!
    In the filter, as each byte is read you could write out the Hex value. That way you should be able to find the offending character(s).

  • Read Doc File

    Hi all,
    I try to ready DOC file using the following code but i face the folowing error.
    IS there any way to read DOC or DOCX files?
    declare
    f utl_file.file_type;
    s varchar2(200);
    begin
    f := utl_file.fopen('OUTPUT','x.doc','R');
    utl_file.get_line(f,s,4000);
    dbms_output.put_line(s);
    UTL_FILE.FCLOSE(f);
    exception
    when NO_DATA_FOUND then
    utl_file.fclose(f);
    end;
    SQL> /
    declare
    ERROR at line 1:
    ORA-29284: file read error
    ORA-06512: at "SYS.UTL_FILE", line 106
    ORA-06512: at "SYS.UTL_FILE", line 746
    ORA-06512: at line 7
    SQL>
    Many Thanks

    thanks EdStevens ,
    Also i try to used this but the results in different charachters.
    CREATE TABLE LOB_TABLE4
    LOB_ID INTEGER,
    lob_name VARCHAR2 (100 BYTE),
    CLOb_COL CLOB
    DECLARE
    L_CLOB BLOB;
    L_BFILE BFILE;
    BEGIN
    L_BFILE := BFILENAME ('LOB_DIR', 'file.doc');
    DBMS_LOB.OPEN (L_BFILE, DBMS_LOB.FILE_READONLY);
    L_CLOB := DBMS_LOB.SUBSTR (L_BFILE, 1, 2000);
    INSERT INTO LOB_TABLE4 (LOB_ID, LOB_NAME, CLOB_COL)
    VALUES (1, '1st Row', UTL_RAW.CAST_TO_VARCHAR2 (L_CLOB));
    COMMIT;
    END;
    SELECT DBMS_LOB.SUBSTR (CLOB_COL, 1000, 1) FROM LOB_TABLE4;
    SQL> /
    the result as follow:
    DBMS_LOB.SUBSTR(CLOB_COL,1000,1)
    ╨╧◄αí▒→ß > ♥ ■  ♠ ☺ . ► 0 ☺ ■    -
                                    ∞Ñ┴ ♥Ç ♦ ≡↕┐ 0 ♫ bjbj┤V┤V
    ♦▬ 4♫ ╓<☺ ╓<☺   ☼   ☼
      ☼ ╖ û♣ û♣ ┘↕ ┘↕ ┘↕ ┘↕ ┘↕ ¶
         φ↕ φ↕ φ↕ φ↕ ♀ ∙↕ ♀ φ↕ σ¶ 0☺ ♣‼
    DBMS_LOB.SUBSTR(CLOB_COL,1000,1)
    ♣‼ ♣‼ ♣‼ ♣‼ ⁿ‼ ⁿ‼ ⁿ‼ d¶ ☻ f¶ f¶
    f¶ f¶ f¶ f¶ $ §▬ ó☻ ╖↑ : è¶ § ┘↕
    ⁿ‼ ⁿ‼ ⁿ‼
    SQL>
    i don't know why? but when i used to .txt it's working no problems but this problem with word file.

  • Problem while reading the file from FTP server

    Hi Friends,
    I have a problem while fetching files from FTP server.
    I used FTP_Connect, FTP_COMMAND function modules. I can able to put the files into FTP server.
    but I cant able to pick the files from FTP server.
    anyone have faced similar issues kindly let me know.
    Thanks
    Gowrishankar

    Hi,
    try this way..
    for reading the file using FTP you need to use different unix command ..
    Prabhuda

  • Problem with opening doc. files in pages '09

    Hello, can anybody help me, ever since i installed " snow leopard" v10.6.2, pages '09 doesn't open doc. files ( word ) anymore.
    Even documents produced in pages en ""saved as" a word document can't be opened again.
    Keep receiving pop up whit message " can not be opened"
    Yves
    Message was edited by: deschutter

    You need to manually install the 10.6.2 "Combo" version, there were problems with just using the regular update.
    See:
    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=153&mforum=iworktips ntrick
    Peter

  • Problem in Reading XLSX File (MS EXCEL 2007).

    Dear All ,
    I am reading all the properties to XL sheet and then utilising it in my code .
    I am getting some problem in reading the Border of the Cell , my code is working fine with most of the Excel Sheet but it can not correctly read the Border of a few Excel files.
    I am using the method ,
    getBorderBottomEnum()
    or
    getBorderBottom()
    but I can not read the Border used correctly for all the Excel Sheet .
    Please Help.
    Please revert if I am not clear.
    Thanking You All.

    I'm guessing that your question is about Apache POI. They don't have a forum AFAIK, but they do have a [url http://poi.apache.org/mailinglists.html]mailing list.
    John

  • Problem in sending .doc file as an attachment.!

    Hi SDN,
    I am using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send a .doc file as an attachment i am filling the the table contents_hex with my internal table containing the data in hex format but the attachment coming to the SAP office inbox is not showing the actual data it's showing the file with all hex values.
    can any one tell the reason?
    Please give sample code if possible for sending a word file as an attachment..
    Regards,
    Rahul

    Hi Rahul,
    I am sending you the sample code I have written for TXT.
    you can use the same code for .doc with small modification.
    You use this code and check once and let me know.
    Sample code:
    Declaration:
    DATA : w_name TYPE sos04-l_adr_name.
    DATA: sent_to_all  LIKE  sonv-flag.
    DATA:
      l_datum(10),
      ls_docdata TYPE sodocchgi1,
      lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
      lt_objhead TYPE TABLE OF solisti1 WITH HEADER LINE,
      lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE,
      lt_objbin TYPE TABLE OF solisti1 WITH HEADER LINE,
      lt_reclist TYPE TABLE OF somlreci1 WITH HEADER LINE,
      lt_listobject TYPE TABLE OF abaplist WITH HEADER LINE,
      l_tab_lines TYPE i,
      l_tab_lines1 TYPE i,
      l_tab_lines2 TYPE i,
      l_att_type LIKE soodk-objtp.
    CONSTANTS : c_tab TYPE x VALUE '09'.     "tab delimiter between records.
    CONSTANTS : c_line(2) TYPE x VALUE '0D'.
    CONSTANTS : l_newline(2) TYPE x VALUE '0D0A'.        "To insert Newline.
    DATA: v_str LIKE lt_objbin.
    *Program logic
    Main Text
      lt_objtxt = 'Dummy heading. ' .
        APPEND lt_objtxt.
        lt_objtxt = '' .
        APPEND lt_objtxt.
    lt_objtxt = 'Dummy second line.'.
        APPEND lt_objtxt.
        lt_objtxt = '' .
        APPEND lt_objtxt.
        lt_objtxt = 'Regards,'.
         APPEND lt_objtxt.
        lt_objtxt = 'Field Service Team' .
        APPEND lt_objtxt.
        lt_objtxt = '----
        APPEND lt_objtxt.
    lt_objtxt = 'This is system-generated email;please do not reply to this
    message.'  .
        APPEND lt_objtxt.
    lt_objtxt = 'If there are any questions regarding this error message'.
        APPEND lt_objtxt.
    lt_objtxt = '----
        APPEND lt_objtxt.
    Write Packing List (Main)
        DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
        READ TABLE lt_objtxt INDEX l_tab_lines.
      ls_docdata-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
        CLEAR lt_objpack-transf_bin.
        lt_objpack-head_start = 1.
        lt_objpack-head_num = 0.
        lt_objpack-body_start = 1.
        lt_objpack-body_num = l_tab_lines.
        lt_objpack-doc_type = 'RAW'.
        APPEND lt_objpack.
    Create Message Attachment   "Attachmant of  file
        LOOP AT itab1.
          CONCATENATE itab1-bldat itab1-blart itab1-bukrs itab1-budat
                      itab1-monat itab1-waers itab1-xblnr itab1-bktxt
                       INTO lt_objbin SEPARATED BY c_tab .
          CONCATENATE  l_newline lt_objbin INTO lt_objbin.
          APPEND lt_objbin.
          CLEAR lt_objbin.
        ENDLOOP.
    Write Packing List (Attachment)
        l_att_type = 'txt'.
        DESCRIBE TABLE lt_objbin LINES l_tab_lines.
        READ TABLE lt_objbin INDEX l_tab_lines.
        lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255
                                        + STRLEN( lt_objbin ).
        lt_objpack-transf_bin = 'X'.
        lt_objpack-head_start = 1.
        lt_objpack-head_num = 0.
        lt_objpack-body_start = 1.
        lt_objpack-body_num = l_tab_lines.
        lt_objpack-doc_type = l_att_type.
        lt_objpack-obj_name = 'Header file name'.
        lt_objpack-obj_descr = 'Header file name'.
        APPEND lt_objpack.
    *refresh bdclm.     "Attachemnt of second file
       CLEAR lt_objbin.
        LOOP AT bdclm.
          CONCATENATE itab2-indate itab2-intime itab2-tcode
                      itab2-longtext
                      INTO lt_objbin SEPARATED BY c_tab.
          CONCATENATE  l_newline lt_objbin INTO lt_objbin.
          APPEND lt_objbin.
          CLEAR lt_objbin.
        ENDLOOP.
        CLEAR lt_objbin.
    Write Packing List (Attachment)
        l_att_type = 'txt'.
        DESCRIBE TABLE lt_objbin LINES l_tab_lines1.
        l_tab_lines2 = l_tab_lines1 - l_tab_lines.
        READ TABLE lt_objbin INDEX l_tab_lines2.
    lt_objpack-doc_size = ( l_tab_lines2 - 1 ) * 255 + STRLEN( lt_objbin ).
        lt_objpack-transf_bin = 'X'.
        lt_objpack-head_start = l_tab_lines2.
        lt_objpack-head_num = 0.
        lt_objpack-body_start = l_tab_lines + 1.
        lt_objpack-body_num = l_tab_lines2.
        lt_objpack-doc_type = l_att_type.
        lt_objpack-obj_name = 'file name '.
        lt_objpack-obj_descr = 'file name '.
        APPEND lt_objpack.
    Create receiver list
        lt_reclist-receiver = '[email protected]'.
        lt_reclist-rec_type = 'U'.
        APPEND lt_reclist.
    Send Message
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                document_data = ls_docdata
                put_in_outbox = 'X'
                 commit_work = 'X '
    *put_in_outbox = ''
            IMPORTING
                sent_to_all = sent_to_all
    VALUE(NEW_OBJECT_ID) LIKE  SOFOLENTI1-OBJECT_ID
             TABLES
                 packing_list = lt_objpack
                 object_header = lt_objhead
                 contents_bin = lt_objbin
                 contents_txt = lt_objtxt
                 receivers = lt_reclist
    *COMMIT_WORK = X
             EXCEPTIONS
                 too_many_receivers = 1
                 document_not_sent = 2
                 document_type_not_exist = 3
                 operation_no_authorization = 4
                 parameter_error = 5
                 x_error = 6
                 enqueue_error = 7
                OTHERS = 8.
    Thanks,
    Yuvaraj

  • How to read .doc files on 5800 express music? pls ...

    When I try and open my .doc files it says file format error or something... Recently installed Office on my phone... New to this... please help...

    Are you sure the Office you downloaded was compatible?
    If you find my post helpful please click the green star on the left under the avatar. Thanks.

  • Problem while reading multiple files through FTP Adapter

    Hi,
    We have a requirement to read the excel files placed in an FTP Location and as there is no Adapter to read Excel file
    we are using FTP Adapter and reading the Header values of the file(name of the
    file) and we are paasing as input to the Java code which will read the data nd insert into the Database.
    If we place above 20 files it was reading only some files and some were left and if we delete the files and place the unread files again some files are read and if we do the same procedure then all the files were read.
    Any help regaring this appreciated.
    Thanks and Regards,
    Nagaraju .D

    Are you doing anything complex for your polling, e.g. Files that must be n time old.
    Can you post the WSDL so I can see the polling configuration. I only need to see the adapter configuration, not the whole file.
    cheers
    James

Maybe you are looking for