Read the properties of a document through a java program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • crossroadsk
    New Member
    • Nov 2006
    • 30

    Read the properties of a document through a java program

    when we right-click and check the properties of any microsoft document or excel sheet, we have some attributes like "title","author " etc..

    i want to get those properties through java and create an XML file.

    How do i read those properties?

    of course i can create an XML after getting those properties....

    Please help me .....
  • crossroadsk
    New Member
    • Nov 2006
    • 30

    #2
    My problem is that whenever i upload a document ... an xml file should get generated with the property attributes of that document


    someone can help me out please?

    Comment

    • crossroadsk
      New Member
      • Nov 2006
      • 30

      #3
      I solved this upto some extent

      use this code:

      import java.io.*;
      import java.util.*;
      public class Props
      {
      public static void main(String args[]) throws IOException
      {
      FileInputStream is = new FileInputStream ("sample.doc ");
      FileOutputStrea m fos = new FileOutputStrea m("samp.txt") ;
      Properties prop = new Properties();
      prop.load(is);
      prop.store(fos, "Heading");
      }
      }

      For this program an output file samp.txt is generated for some document called "sample.doc "
      Now from the text file i need to extract the Values because the actual attributes are listed in the file but not in order.

      Can anyone please help me extract the key-value pairs for these attributes from that file?

      Comment

      Working...