×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    43

    How to read doc file?

    It is ok to read .txt file using the following code?
    But it does not work for reading a doc file.
    How can a doc file can be read?

    Code:
    try {
    			fileconnection=(FileConnection)Connector.open("file:///root1/read/blink.txt");
    			InputStream is = fileconnection.openInputStream();
    			StringBuffer sb = new StringBuffer();
    			int chr, i = 0;
    			// Read until the end of the stream 
    			while ((chr = is.read()) != -1)
    			sb.append((char) chr);
    			//System.out.println(sb.toString());
    			Alert alert=new Alert("",sb.toString(),null,AlertType.INFO);
    			SecondTestFileMIDlet.secondtestfilemidlet.display.setCurrent(alert);
    			
    		} catch (IOException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,545

    Re: How to read doc file?

    Same way for starters (use JSR-75, FileConnection API to open and read the file contents), but then you need to also know how to handle the .doc file format itself. There's no support for that in J2ME.

    You could take a look at the LibreOffice source code to see how .doc file are handled, or get .doc file format specifications from Microsoft.

    LibreOffice is here: http://www.documentfoundation.org/download/

    It might, however, be too big a thing to implement (Microsoft .doc file support in J2ME).

Similar Threads

  1. free application for editing .doc,.ppt,.xls file
    By navmittal in forum Symbian C++
    Replies: 1
    Last Post: 2009-08-13, 10:40
  2. Replies: 3
    Last Post: 2008-03-04, 11:22
  3. Create own ini file and read/use content of this file
    By kaiten-sushi in forum Symbian C++
    Replies: 6
    Last Post: 2007-03-26, 16:26
  4. Replies: 7
    Last Post: 2006-03-02, 07:50
  5. Help:can Series 40 open the MMS file and read this file??
    By evicn in forum Mobile Java General
    Replies: 0
    Last Post: 2004-04-28, 03:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •