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
https://forums.phpfreaks.com/topic/14885-writing-to-ms-word-with-php-on-linux/
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.
[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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.