Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

regarding conversion

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi all,i am a fresher ...
during the project i have come across one problem
after converting .gif to .doc,the doc file is not in readable format...
to make it readable what can i do??
my code is like this:

import java.io.*;
import java.util.zip.*;
public class ReadGif{
public static void main(String args[]) throws Exception{
FileInputStream fis=new FileInputStream("D:/Myapps/read/4843a349.gif") ;
FileOutputStream fos=new FileOutputStream("d:/Myapps/1.doc");

int dt;
while((dt=fis.read())!=-1){
fos.write((char)dt);
}
fis.close();
fos.close();
}
}
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
You did not "convert" the file. You renamed it with a different extension, and file extensions have nothing to do with the content of the file. The only way I know to "convert" an image into a Word Document would be to create a new word document and place the image into it. Open Office exposes a Java API that can be used to do that, but it is non-trivial.
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Erm, that's not converting anything. All you are doing is writing the bytes of a GIF file into a file that has a *.DOC extension.

Actually taking a GIF image and writing into a valid Word document (I presume that's what the *.DOC extension is signifying) is quite a hard task.

There are third-party libraries that can help with this. But, unless I have misunderstood your question or your code, it seems like your general knowledge of computing would need to advance considerably, before you could successfully use such a library.

I would suggest trying some simpler tasks, and reading some good get-me-started books or Web-sites.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic