Hi all
How to convert doc to xml PHP software?
I would like to get a licensed converter to be sure that I am having a secure software in my computer system. I don’t want to compromise or risk the safety of computer operating system which is windows 7 64 bit.
I know you can help me.
Thanks and have a nice day.
Answered By
manpreet
0 points
N/A
#186177
How to convert doc to xml php software?
Hello,
What exactly you need? You need to convert DOC or DOCX file into HTML. For DOCX file you need to extract DOCX file with PHP script then you need to read from that file. I am sending following script for your help :
function mailMerge($dirName, $templateFile, $newFile)
{
if (!copy($dirName.$templateFile, $newFile)) // make a duplicate so we don't overwrite the template
return false; // could not duplicate template
$zip = new ZipArchive();
if ($zip->open($newFile, ZIPARCHIVE::CHECKCONS) !== TRUE)
return false; // probably not a docx file
$file = substr($templateFile, -4) == '.odt' ? 'content.xml' : 'word/document.xml';
return $data = $zip->getFromName($file);
$zip->deleteName($file);
$zip->addFromString($file, $data);
$zip->close();
return true;
}
$newFile = tempnam(sys_get_temp_dir(), '.dat');
$dirName = 'abc/';
$templateName = "test.docx";
$lol = Â mailMerge($dirName, $templateName, $newFile);
print_r($lol);
Or you can use Zend Framework it has built in functionality.