Jump to content

Writing to MS Word with PHP on Linux


Gast

Recommended Posts

Does anyone know if it is possible? I understand you need the COM extension on a Microsoft Server, but is there a way to get it to work on a Linux system?

Also, can't you just use fwrite()? I have made an Excel document using only PHP's functions so maybe it is possible with Word?
Link to comment
Share on other sites

You probably did not create a true excel file...probably a csv that excel opened and was able to manipulate.  I don't think it's possible to create a true MS word file without using COM.  You can write .txt and I think .rtf files in straight text which word will manipulate.  The rtf (rich text format, which is what wordpad produces) MS Word will work with, and you can apply formatting to the text...bold, italic, and such.
Link to comment
Share on other sites

[quote author=hitman6003 link=topic=100925.msg399003#msg399003 date=1153184292]
You probably did not create a true excel file...probably a csv that excel opened and was able to manipulate.  I don't think it's possible to create a true MS word file without using COM.  You can write .txt and I think .rtf files in straight text which word will manipulate.  The rtf (rich text format, which is what wordpad produces) MS Word will work with, and you can apply formatting to the text...bold, italic, and such.
[/quote]

I might have to go with the RTF option as a customer wants basically to be able to get a script to generate letters that he can "mail merge" in Word.

Also, about the Excel file, it wasn't a CSV file, it was an XLS file. Basically if you write to one using fwrite() etc, you can use the tab character "\t" to move to each cell. I will post the script when I find it in a minute out of interest.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.