The content of this section:
A class of PHP export documents
Example:
Copy Code code as follows:
<?php
/**
* Generate classes for Word documents
*
*/
Class Word
{
function Start ()
{
Ob_start ();
Echo ' xmlns:w= "Urn:schemas-microsoft-com:office:word"
xmlns= "HTTP://WWW.W3.ORG/TR/REC-HTML40" >;
}
function Save ($path)
{
echo "$data = Ob_get_contents ();
Ob_end_clean ();
$this->wirtefile ($path, $data);
}
function Wirtefile ($FN, $data)
{
$FP =fopen ($FN, "WB");
Fwrite ($fp, $data);
Fclose ($FP);
}
}
Exported Program Files
Export---start---
Require site_root. ' include/word.class.php '; The class file is placed under the Include folder under the root directory
$word = new Word ();
Query data fill in Word
$result = $db->query ("SELECT * from".) Db_pre. " box where status= ' 9 ' ORDER by Boxid DESC ');
while ($r = $db->fetch_array ($result))
{
$r [' orderinfo '] = $db->get_one ("SELECT * from".) Db_pre. " Order where orderid= ' ". $r [' OrderID ']." ' ");
$r [' wrapinfo '] = $db->get_one ("SELECT * from".) Db_pre. " Wrap where orderid= ' ". $r [' OrderID ']." ' ");
$boxlist [] = $r;
}
foreach ($boxlist as $key => $val) {
$order->upcabarcode ($val [' Box_code ']);
$html. = ' <table width=800 cellpadding= "6" align= "Center" cellspacing= "5" bgcolor= "#000000" >
<tr bgcolor= "White" height= "M" >
<TD width=80 style= "border:1px solid #c8c8c8;" >igo <br/> dan Number </td>
<TD width=300 style= "border:1px solid #c8c8c8;" ><br/> '. $val [' Box_code ']. ' </td>
<TD width=60 style= "border:1px solid #c8c8c8;" > Date </td>
<TD width=100 style= "border:1px solid #c8c8c8;" > '. Date (' y-m-d ', $val [create_date]). ' </td>
<TD width=100 style= "border:1px solid #c8c8c8;" > Logo <br/> name </td>
<TD width=240 style= "border:1px solid #c8c8c8;" > '. $val [code]. ' /'. $val [' OrderID ']. ' <br/> '. $val [' OrderInfo '] [' user_name ']. ' </td>
</tr>
<tr bgcolor= "White" >
<TD width=60 style= "border:1px solid #c8c8c8;" Number of > Pieces </td>
<TD width=40 style= "border:1px solid #c8c8c8;" >3</td>
<TD width=40 style= "border:1px solid #c8c8c8;" > Weight </td>
<TD width=150 style= "border:1px solid #c8c8c8;" >56.5</td>
<TD width=40 style= "border:1px solid #c8c8c8;" > Name </td>
<TD width=390 style= "border:1px solid #c8c8c8;" > Bite, Sucker Bowl, learn to drink cups, dried fish oil </td>
</tr>
<tr bgcolor= "White" >
<TD width=110 style= "border:1px solid #c8c8c8;" > Services <br/> Categories </td>
<TD width=200 style= "border:1px solid #c8c8c8;" > Warehouse Services </td>
<TD width=110 style= "border:1px solid #c8c8c8;" > Services <br/> Requirements </td>
<TD width=280 style= "border:1px solid #c8c8c8;" > Small Box </td>
</tr>
<tr bgcolor= "White" >
<TD width=120 style= "border:1px solid #c8c8c8;" ><br/><br/> Customer <br/> Notes <br/><br/></td>
<TD width=580 style= "border:1px solid #c8c8c8;" > '. $val [' OrderInfo '] [' Beizhu ']. ' </td>
</tr>
<tr bgcolor= "White" >
<TD width=120 style= "border:1px solid #c8c8c8;" ><br/><br/><br/> Arrival <br/> Situation <br/><br/><br/><br/></td>
<TD width=580 style= "border:1px solid #c8c8c8;" > What's the problem? What's the point of <br/>? What's the point of <br/>? The fruit is not up to <br/><br/><br/><br/><br/><br/><br/><br/></td>.
</tr>
</table> <br/><br/><br/><br/>
';
}
$word->start ();
$filename = ' Picking manifest export. doc ';
Echo $html;
$word->save ($filename);
Type of File
Header (' Content-type:application/word ');
Header (' content-disposition:attachment; filename= ' picking order export. doc ');
ReadFile ($filename);
Ob_flush ();
Flush ();
Exit ();
Export Word--end--