View Full Version : edit a word document

12-18-2010, 01:27 PM
hi every one,
i am really enjoying my php at the moment.
but i have hit a problem
i have a word document that is attached below. and i want to be able to edit it. But the word document needs to have formating page size and margins.

now the problem with fopen seems to strip the formating off the page. and i have try LOADS of class but no look there.

can anyone help me with this please.
all i need the is finishing format to be doc or docx

thanls alot

12-18-2010, 01:37 PM
You can't really edit a real MS Word document.

There are PHP scripts for editing RTF (rich text font) files, but not MS Word specifically.
This is what I'm talking about: http://tinymce.moxiecode.com/

Do you mean an RTF file, or are you specifically talking about MS Word?

12-18-2010, 02:20 PM
actually yes
a rtf file would work.
how would i go about creating and editing a rtf file with my correct page size and margins? as i tryed fopen then but it messes up the whole document?

12-18-2010, 08:57 PM
You'll have to use tinymce or fckedit ... two RTF PHP editors for websites.

To create your own RTF editor would be extremely difficult.

I have other solutions you may want to look into ... not being sure what
your website is all about.

1) WordPress ... use WP as a website CMS -- you would have to redo your site.
2) Use Google Docs. Have your clients create a free Google Account and use
the online free Google Docs to form all of their online content. That content can
be embedded on any website. It's RTF.

12-18-2010, 09:26 PM
all it is, is i want to print a lable.
so i have wrote a bat file to print word documents.
so all i need to do is edit the word document (data posted from a form) and then run the bat file with the exec("cmd.exe /c print.bat"); and that will print a lable.

Though thanks to you i found out that my bat file also prints rtf files.

so all i need to know is how to edit a word document which you have said is hard.

so i just need to know how to go about genarating/edit a rtf. which you said is possbale. though i have tried editing rtd file (editing job number and date to relivent infomation) but when i then open that file on word is just displays the data i put in
tf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stsh fbi31506\deflang2057\deflangfe2057 hemelang2057 hemelangfe0 hemelangcs0{
............................. ongoing
instead of just

job number {post jobnumber}

thanks for your help seriously

12-18-2010, 10:02 PM
Check out PHPDocX (http://www.phpdocx.com/). It might be useful to you.