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!
I can get the Microsoft Word document to display on our web page, but it does not display cleanly and has all the formatting characters scattered across the screen. Is there a way to filter the document so the formating is applied and the document appears cleanly? If not, is there a way to do that with a PDF file? Here is the code we are using:
If they're actual .doc files and not HTML with the wrong extension then you need to display the file contents and only the file contents. No extra HTML.
<?php
if (the script should show a file) {
header("Content-Type: application/msword");
show file contents here
exit;
}
show the HTML to let the user choose a file
?>
tasairis wrote:If they're actual .doc files and not HTML with the wrong extension then you need to display the file contents and only the file contents. No extra HTML.
<?php
if (the script should show a file) {
header("Content-Type: application/msword");
show file contents here
exit;
}
show the HTML to let the user choose a file
?>
Which would only work if the enduser has Microsoft Word installed on his computer. If you want a universal solution, your best bet would be to convert your word documents to HTML format (Word can do this) and provide the original document for download.
The documents are actually Word .doc documents. Somewhere I had read that IE and Firefox knew how to correctly display such documents. I was just looking for the mechanism. If I have to convert them all of the time, why use Word? The browsers gripe when there are two consecutive blanks, periods, etc. in a sentence, or when you use an apostrope or quotes.
JackD wrote:Somewhere I had read that IE and Firefox knew how to correctly display such documents.
They only know if, as John said, the user has Word (or an appropriate viewer) installed on their machine. No browser comes with built-in support for it.