alejandro52 Posted August 10, 2007 Share Posted August 10, 2007 When i try to open and display ms documents in my web page all i get is mHsHhi?i??CJaJmH sH hi?i??CJaJmHsHhi??CJaJmHsHhi?aJmHsH"(VX?Ĉ?$ & F H ? ? 46?????瀀瀀׀瀀瀀?????ˀ?ˀˀˀˀˀˀˀ? $?Ђ`?Ђa$gdi?$???Ђ^???Ђa$gdi?$??Ђ^?`?Ђa$gdi?$a$gdǯ̀??ă? ?????? ?? ?????? ă? .Does any one know what is the problem? Quote Link to comment https://forums.phpfreaks.com/topic/64265-solved-ms-documents-with-fopen-and-fread/ Share on other sites More sharing options...
Mr P!nk Posted August 10, 2007 Share Posted August 10, 2007 What exactly are you doing and what do you want to happen? Quote Link to comment https://forums.phpfreaks.com/topic/64265-solved-ms-documents-with-fopen-and-fread/#findComment-320367 Share on other sites More sharing options...
lemmin Posted August 10, 2007 Share Posted August 10, 2007 Word has special format characters. I don't know if there is an easy way to remove the formatting, I think you would have to create your own method. Quote Link to comment https://forums.phpfreaks.com/topic/64265-solved-ms-documents-with-fopen-and-fread/#findComment-320369 Share on other sites More sharing options...
HuggieBear Posted August 10, 2007 Share Posted August 10, 2007 I think fopen() is aimed at ASCII data, not Binary data (Like a .doc file). I'd use COM objects to get around this issue. Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/64265-solved-ms-documents-with-fopen-and-fread/#findComment-320375 Share on other sites More sharing options...
Mr P!nk Posted August 10, 2007 Share Posted August 10, 2007 why not try using <?php include('word.doc'); ?> ? Quote Link to comment https://forums.phpfreaks.com/topic/64265-solved-ms-documents-with-fopen-and-fread/#findComment-320376 Share on other sites More sharing options...
HuggieBear Posted August 10, 2007 Share Posted August 10, 2007 Mr P!nk, have you tried it before suggesting it? Give it a go and see what happens! Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/64265-solved-ms-documents-with-fopen-and-fread/#findComment-320382 Share on other sites More sharing options...
alejandro52 Posted August 10, 2007 Author Share Posted August 10, 2007 I have some ms documents that i want to upload to my web page as news.What is the best way to do that?do i have to format them in txt?I'm currently doing this(doc to txt) but the problem is that the text format(paragraphs and such) disappear and the only way i can see to add them back is by adding html tags in the text files.Is there an easier way? COM Seems a bit comfusing and only works in windows php. Quote Link to comment https://forums.phpfreaks.com/topic/64265-solved-ms-documents-with-fopen-and-fread/#findComment-320384 Share on other sites More sharing options...
HuggieBear Posted August 10, 2007 Share Posted August 10, 2007 Nothing's going to keep the formatting unless you save your word document as HTML (I believe there's an option when you Save As...) but it'll contain all Microscofs proprietory rubbish! Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/64265-solved-ms-documents-with-fopen-and-fread/#findComment-320390 Share on other sites More sharing options...
lemmin Posted August 10, 2007 Share Posted August 10, 2007 Word documents would have the same problem as txt (even if you got all that weird formatting out.) The problem is that the browser has its very own syntax for formatting and the only way to get a new line is with a tag. One thing you can do is, when you read the file into a buffer, you can simply replace all occurances of "\n" with "<br>" and whatever other formatting tags you need. Quote Link to comment https://forums.phpfreaks.com/topic/64265-solved-ms-documents-with-fopen-and-fread/#findComment-320392 Share on other sites More sharing options...
alejandro52 Posted August 10, 2007 Author Share Posted August 10, 2007 So the best way is to convert them in txt and add html tags in them? Quote Link to comment https://forums.phpfreaks.com/topic/64265-solved-ms-documents-with-fopen-and-fread/#findComment-320393 Share on other sites More sharing options...
HuggieBear Posted August 10, 2007 Share Posted August 10, 2007 In short, yes! You could open the document, read in the contents and then try and format it, but by the time you've learned about COM objects and written the PHP you'd have been quicker to do it manually. Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/64265-solved-ms-documents-with-fopen-and-fread/#findComment-320402 Share on other sites More sharing options...
alejandro52 Posted August 10, 2007 Author Share Posted August 10, 2007 ok,thx! Quote Link to comment https://forums.phpfreaks.com/topic/64265-solved-ms-documents-with-fopen-and-fread/#findComment-320518 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.