Create Word document code directly with PHP (the system does not need to install the word software): First, use $word->start () to indicate that you want to build the Word file. Then you can output any HTML code, whether it is read from the file and then written here, or directly here to output HTML, there is no relationship.
Create Word document code directly with PHP tutorial (System does not need to install Word software)
How to use:
First, use $word->start () to indicate that you want to generate a Word file. Then you can output any HTML code, whether it is read from the file and then written here, or directly here to output HTML, there is no relationship.
When you are finished, use the $word->save ($path) method, where $path is the name of the word file that you want to generate (you can give the full path). When you use the $word->save () method, Any output after this is not related to the Word file, which means that word generation is complete. You can then pull the same way you would normally use PHP. Whatever you export, output directly in the browser, but not in Word.
*/
Class Word
{
function Start ()
{
Ob_start ();
print ' xmlns:w= ' Urn:schemas-microsoft-com:office:word "
xmlns= "HTTP://WWW.W3.ORG/TR/REC-HTML40" > ";
}
function Save ($path)
{
Print "";
$data = Ob_get_contents ();
Ob_end_clean ();
$this->wirtefile ($path, $data);
}
function Wirtefile ($FN, $data)
{
$FP =fopen ($FN, "WB");
Fwrite ($fp, $data);
Fclose ($FP);
}
}
Generate Word Call method
Include ("word.php");
$word =new Word;
$word->start ();
http://www.bkjia.com/PHPjc/444887.html www.bkjia.com true http://www.bkjia.com/PHPjc/444887.html techarticle Create Word document code directly with PHP (the system does not need to install the word software): First, use $word->start () to indicate that you want to build the Word file. Then you can output any HTML code, regardless of ...