hi,...
maybe my explanation not so good sorry because english is not my native language 🙂.
ok, when I generate document word with .htm template I got one problem with image. When I run the script the image won't show up because the path of image always change. So on the template I add text to replacement :
<img src="#image#" width="200" height="150">
but when I save it, let say document1.doc it's always change to :
<img src="document1_Files/image001.jpg" http://localhost/images/image001.jpg width="200" height="150">
So maybe anyone have exprerience with this problem I need suggestion or help, here the code for generate:
$fname = "document1";
// file template
$handle = fopen("template.htm", "r");
$string = '';
$l=0;
while (!feof ($handle))
{
$string = $string.fgets($handle, 4096);
$l +=4096;
}
$l += 5000000;
fclose ($handle);
header("Content-Type: application/msword; charset=windows-1252");
header('Content-Disposition: filename="'.$fname.'.doc"');
$to = "http://localhost/images/image001.jpg";
// here for replace
$string = ereg_replace("#image#", $to,$string);
// ...etc
echo $string;
any help or suggestion is very appreciated.
Thanks you
NB: the template file was generate from ms word, save as .htm.