![]() |
Exporting to microsoft word documents - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Exporting to microsoft word documents (/showthread.php?tid=3172) |
Exporting to microsoft word documents - El Forum - 09-13-2007 [eluser]simpleCoder[/eluser] Does anyone know how to export html to Microsoft word .I have this project that requires generation of performance reviews in microsoft word so users can edit their review further. At the moment , i am only using PDF libraries . Exporting to microsoft word documents - El Forum - 09-27-2007 [eluser]Crafter[/eluser] I know there is a solution using COM objects, but there are Windows specific, and I'm not windows-savy. For a true cross platform solution, I used RTF files with placeholders, where I performed string replacements. I used a similar approach fro an Excel file, where I conrted the Excel file to an XML file, then placed placeholders in significant positions. The XML route will take macros etc, acroos, whereas the RTF route is for pure formatting. The elegant way is move away from Word and do the report in OpenOffice. EDIT: Excuse me, but after posting I noticed you asked for a conversion of HTML to Word. My suggested solutions may not be the best approch. However, just try forcing the page download as a word document using headers and Word should open the file ok. Exporting to microsoft word documents - El Forum - 09-27-2007 [eluser]Derek Allard[/eluser] Quote:However, just try forcing the page download as a word document using headers and Word should open the file ok.That is a great solution Crafter - elegant. John, I'd love to know if you tried it, and if you found any issues with it, but I think that Word can in fact open html docs, so that should be very nice. For the record, I think it would be Code: header("Content-Type: application/msword");. Exporting to microsoft word documents - El Forum - 09-27-2007 [eluser]Crafter[/eluser] Hey Derek, long time... Quite correct on your header. Here's how I force the page into the office application (and give it a file name too! Code: header("Content-Type: application/vnd.ms-word"); Exporting to microsoft word documents - El Forum - 09-28-2007 [eluser]bonza[/eluser] I've done a fair bit of work creating MSWord format documents from (Linux) web apps. Office 2003 has a native XML format which means you don't have to use COM objects to create Word docs. It's relatively simple - create a template in word to get the formatting correct, create place holders for your required text and then substitute the dynamic content at run time. Alternatively, you could create the whole document on the fly using template stubs which you can call as needed. Exporting to microsoft word documents - El Forum - 12-08-2007 [eluser]llbbl[/eluser] Use open document format, its better ![]() Exporting to microsoft word documents - El Forum - 02-25-2009 [eluser]xico[/eluser] [quote author="Crafter" date="1190977145"]Hey Derek, long time... Quite correct on your header. Here's how I force the page into the office application (and give it a file name too! Code: header("Content-Type: application/vnd.ms-word"); I haven't used ur code but it seems that it will work , can you please tell me what will be in the $mydata variable Exporting to microsoft word documents - El Forum - 02-25-2009 [eluser]Crafter[/eluser] xico, $nydata will be the content of your document. In the context of the thread, it will be formatted HTML text that will be loaded into your word-processor. Exporting to microsoft word documents - El Forum - 06-06-2009 [eluser]Bikun[/eluser] Has anybody managed to save Word files in a UTF format? I tried to use Code: header("Content-Type: application/msword; charset=utf-8"); but files still seem to save in a wrong format. Exporting to microsoft word documents - El Forum - 07-06-2009 [eluser]moodsey211[/eluser] Hi guys. Actually you could generate a word document using it's XML format. Microsoft XML formats It also works for excel. I've been doing this for quite sometime now. You generate the xml file and download it with a dot doc extension. MS Word would then parse it as though it was really a doc file. Hope that helps. Best regards, moodsey211 Note: I've only tried this using the following MS Office version: 2003 2007 |