1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| <?
/* Chaine avec balises RTF - backslashes échappés - récupérée d'où tu veux */
$ch_rtf="{\\rtf1\\ansi\\ansicpg1252\\deff0{\\fonttbl{\\f0\\fswiss\\fcharset0 Arial;}}
{\\*\\generator Msftedit 5.41.15.1507;}\\viewkind4\\uc1\\pard\\lang1036\\b\\f0\\fs20 test\\b0\\par
}";
/* Création/ouverture fichier temp texte pur */
$fp=fopen('./temp.txt','w+');
/* On écrit la chaine RTF */
fwrite($fp,$ch_rtf);
/* On ferme */
fclose($fp);
/* Création objet com Word */
$oleWord=new com("Word.application");
$oleWord->Visible=0;
/* On ouvre notre fichier temp */
$oleWord->Documents->Open("E:\\easyphp_data\\www\\test\\temp.txt");
/* On enregistre au format HTML */
$oleWord->Documents[1]->SaveAs("E:\\easyphp_data\\www\\test\\doc.html",8);
/* On quitte Word */
$oleWord->quit();
/* On insère le doc html obtenu */
include('./doc.html');
?> |
Partager