PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Using the following PHP code to download table content into a .doc woks fine on Windows but on a Mac it give the error message. “Sorry Pages can’t open this for some reason”.
Tried various versions using quote's "Filename=blah-blah.doc” "
I have tried multiple ways around this including using .rtf, .pdf, .csv (.cvc works but is not usable) but none will open in Pages. I even tried converting the headers from .doc to .pages but again nothing. If I simply click on a word document it opens fine in Pages so its not a local issue as far as I can see. The content in the database is just text with nothing else and I can easily echo this to a .php page so there is something within the headers that .pages seems to need. Anyone ever dealt with this for Pages before? Nothing is coming up on the web despite a day of searching.
Hi Christopher, many thanks for taking the time to reply. I probably needed to be a little more clear in my first post. I don't actually store a .doc on the server I just create this by pulling content from the DB. This is a sample of the page I use that works on Windows/Word. So if sombody follows a link to this page it automatically downloads the document.
Thanks for the reply. That's just a sample of what I've tried which worked on a PC but I can't get the same result for Mac - Pages. At this stage it's getting beyond my limited knowledge of PHP. I thought this should have been a fairly simple script to just output some specific page text-content to a file similar to a PDF etc. but it looks like I'm wrong.
The headers tell the browser what type of document is being sent to it. To generate a Word document from data, look into classes like: https://github.com/PHPOffice