Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Reading Word Office File
Old 01-17-2010, 07:02 AM Reading Word Office File
Experienced Talker

Posts: 34
Trades: 0
Hi There,

Is there a possible way to read contents of word file. I have applied techniques through COM class, readfile, file and fread but none of them are working. COM class gives error, and rest of the functions give encrpyted data output.


Regards,
Anum
autumn is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-17-2010, 07:33 AM Re: Reading Word Office File
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
maybe by using a program like antiword [ http://www.winfield.demon.nl/ ] to extract the text.
Word have a closed format, so don't expect it to be able to extract everything...

Otherwise, maybe you coud try to script openoffice to convert the word document to an odt file.
Those are xml, and should be parsable with less hassle.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-17-2010, 08:35 AM Re: Reading Word Office File
Experienced Talker

Posts: 34
Trades: 0
Thanks for your reply, converting file in odt format will require openoffice to be configured in any system, and its not common in most of the systems.
autumn is offline
Reply With Quote
View Public Profile
 
Old 01-17-2010, 08:41 AM Re: Reading Word Office File
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You are missing the point totally!

Word files are in a format that PHP CANNOT read easily. .odt files are actually a formatted XML document so can be read with standard PHP classes.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-17-2010, 10:00 AM Re: Reading Word Office File
Experienced Talker

Posts: 34
Trades: 0
oks,

thanks for response. Got the point.

Cheers.
autumn is offline
Reply With Quote
View Public Profile
 
Old 01-18-2010, 01:28 PM Re: Reading Word Office File
Junior Talker

Posts: 3
Name: Shannon Prue
Trades: 0
autumn,

I wanted to mention a possible solution. Google docs API offers the ability to upload both .doc and .docx to their service. The files are very accurately decrypted. Being tech support for RSSBus I am a bit biased in how I would attach to the google services. RSSBus can (using the GoogleOps connector) make connecting to this service and working with the results quite simple.

I do not have an example posted in our template gallery illustrating exactly what you are trying to accomplish, but I do have an example that can give the general idea of how something like this is accomplished here.

If you do decide to use RSSBus to accomplish this task you can easily make a service that runs on your server to take a .doc/docx file, upload to Google Docs, then return the decoded plain text. Allowing your php script to just pass the name/location of a file and wait for the resultig text.

-Shannon
TheSingularity is offline
Reply With Quote
View Public Profile
 
Old 01-19-2010, 09:09 AM Re: Reading Word Office File
Experienced Talker

Posts: 34
Trades: 0
Thanks Shannon,


Thats a very nice solution, I certaintly will try it.



Regards and Cheers
autumn is offline
Reply With Quote
View Public Profile
 
Old 01-21-2010, 09:25 AM Re: Reading Word Office File
Junior Talker

Posts: 3
Name: Shannon Prue
Trades: 0
You are quite welcome, glad I could help.
TheSingularity is offline
Reply With Quote
View Public Profile
 
Old 01-21-2010, 09:40 AM Re: Reading Word Office File
xela1966's Avatar
Super Talker

Posts: 135
Name: Baptista
Location: Alvor, Algarve Portugal
Trades: 0
You can read a txt file with phpas follow:

$yourFile = "testFile.txt";
$fh = fopen($yourFile, 'r');
$theData = fread($fh, filesize($yourFile));
fclose($fh);
echo $theData;
__________________
Algarve Holidays
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
xela1966 is offline
Reply With Quote
View Public Profile Visit xela1966's homepage!
 
Old 01-21-2010, 09:48 AM Re: Reading Word Office File
Junior Talker

Posts: 3
Name: Shannon Prue
Trades: 0
Quote:
Originally Posted by xela1966 View Post
You can read a txt file with phpas follow:

$yourFile = "testFile.txt";
$fh = fopen($yourFile, 'r');
$theData = fread($fh, filesize($yourFile));
fclose($fh);
echo $theData;
unfortunately a .doc/.docx file is not text, it's an encoded proprietary format.
TheSingularity is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Reading Word Office File
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.35833 seconds with 12 queries