Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Accessing Meta data from MS WORD

by ghouse_55 (Initiate)
on Aug 07, 2012 at 09:04 UTC ( #985923=perlquestion: print w/ replies, xml ) Need Help??
ghouse_55 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Need some info on accessing MS word meta data information of a document via Perl Is this possible via Perl & can you give me some guidance on how to go about this

Comment on Accessing Meta data from MS WORD
Re: Accessing Meta data from MS WORD
by thmsdrew (Scribe) on Aug 07, 2012 at 10:46 UTC

    Well a .docx file is actually just an archive file containing the metadata that you speak of. In Perl it is possible to access an archive file, extract the metadata (which would be a .xml file), and then you can parse the .xml file for what you need. These tasks are accomplished with specific Perl modules that can be found on CPAN.

      ... assuming of course that the file in question is in Microsoft's OpenXML format. Older versions of Word used the proprietary binary ".doc" format, which is still quite frequently used.

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
Re: Accessing Meta data from MS WORD
by sundialsvc4 (Abbot) on Aug 07, 2012 at 12:58 UTC

    /me nods...

    IIRC, docx is an XML-formatted file with a well-known public schema, zip-compressed.   If you do not already find a CPAN module to do what you want, an approach could be to write code that unzips it, then attacks the XML content using XPath expressions ... thus avoiding the need to write code to match the XML internal structure.   But it is extremely likely that what you are doing is “a thing already done.”

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://985923]
Approved by Ratazong
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2014-09-20 18:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (160 votes), past polls