Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read & write .doc files using perl

Status
Not open for further replies.

m4trix

Vendor
Jul 31, 2002
84
CA
I have a MS word .doc file that contains a table with information in it. I want to be able to read the table contents and write to them using perl. Is there any way to do this? I ask because upon opening it up in a text editor, I was presented with the kind of "junk" I see when I try opening .exe files. it starts out with lines and lines of stuff like "ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ" then allkinds of other wierd stuff, "  P  bjbjŽÙŽÙ" etc..
then there's the table data. it appears each cell is separted by a "". None of that really matters. What I want to know is if there is any way to decode this or figure out how to decode it. I can access the data using perl easily, I just can't write to the file, because I don't know what any of the ascii there means
 
I've never done it, but the Perl OLE module should give you access to the contents of .doc files. I have played with Excel files which are easy to navigate with row/column. I don't know how you'd navigate a word doc. ......OLE, anyway. 'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
I don't see a module for reading/writing .doc files on surprising....

There is one for reading RTF files and Word can read and write those. Mike
________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
yeah mike, that's what I did before writing this. I saved the .doc file as a .rtf file and opened it up in a text editor. It is just plain text, and understanding how the program draws tables is as simple as knowing HTML. so I just wrote the perl program to run through the file pulling out the data from between the code creating the table. works great. I was just hoping I could do it with a .doc. Although in all reality, it doesn't REALLY matter. because it LOOKS the same in both formats
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top