![]() |
Text from Word-document
Hi!
I run the website for our neighbourghhood, and sometimes they have protocols that I need to publish on our website. The problem is that when they write the protocol, they use Word. If it's just text, it's working great to just copy, and paste it into the newsmanager I've coded. However, sometimes they've used bold stuff, which is quite easy to just use <strong>. The real problem is when they use tables. So I'm wondering if PHP can access a worddocument's properties and copy the text from it(with a custom function perhaps?), and if it locates a table, write out a html table that matches it? Bold text to be strong, and italic text as it is. Thanks in advance! Tanax |
You could use a JavaScript editor like TinyMCE. That will allow you to keep all of the formatting when copied.
|
Hmm, I suppose you could cobble something together with COM.
|
Quote:
Quote:
|
How are their tables typically laid out in the text files?
|
http://www.microsoft.com/com/default.mspx
You could do something like this, however I believe you will need word installed on your server!(help me out windows guys) which may or may not be possible, any who this is how you would do it (I think :-/). PHP Code:
Not tested btw. |
Quote:
Quote:
Thanks! |
That works SketchMedia, with a little bit of re-working. I used the following code and it output a txt document for me, with a folder as well with 2 other files in:
php Code:
|
Quote:
Just a question though. Where do you find info about the Documents and Open thingy? As used here: PHP Code:
PHP Code:
Anyways, thanks! However, I didn't really want to save it as a txt.. I wanted to get the HTML code so I can post it on the website, without having to write the HTML code for bold and tables wherever they are used.. |
Quote:
http://msdn.microsoft.com/en-us/library/bb216319.aspx http://msdn.microsoft.com/en-us/library/bb221597.aspx http://msdn.microsoft.com/en-us/library/bb238158.aspx It should save it in html format, theoretically. |
I have been looking for a way to do this on a linux shared server, meaning no word to open. Anyone got a solution for that? I had to ask..
|
Quote:
And yes, I hate that site.. :S But thanks, I'll try it! |
Why don't you code an option so that a user can upload files with a newsitem for example? That way the user just can upload the Word document to the server (and visitors can download the document).
|
Because these so called "users" are 60 years old, and don't know how to use a computer, nontheless upload files xD only thing they know is Word, so I have to do all the news publishing. However, yes, I could allow the visitors from our neighbourghhood to download the word document, but better to actually be able to publish something, so that's why :-)
|
| All times are GMT. The time now is 10:15 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0