Location: PHPKode > scripts > MS Word And Excel > ms-word-and-excel/index.php
<title>Creating Ms Word And Ms Excel Document With Simple Php Class</title>
<?php
include("MsWord.Class.php");


if(isset($_REQUEST["Doc"]))
{
$doc = new MsCreator();
$doc->File = "Ashfaq";
$doc->Type = "";
$doc->Text = "
<h3>This Is Testing Word Document Created With MsWord Class.<br> Developed by Ashfaq!</h3>
<table border='1' width='900%' style='border-collapse: collapse;'>
<tr bgcolor='gray' style='color: white;'>
<th>#</th>
<th>Name</th>
<th>Email</th>
<th>Mobile</th>
<th>City</th>
<th>Country</th>
</tr>
<tr>
<td width='100' align='center'>1</td>
<td width='200' align='left'>Ashfaq</td>
<td width='200' align='left'>hide@address.com</td>
<td width='100' align='center'>0333-2710311</td>
<td width='100' align='center'>Hyderabad</td>
<td width='100' align='center'>pakistan</td>
</tr>
</table>
";
//$doc->Preview();
$doc->Download();
}

if(isset($_REQUEST["Excel"]))
{
$doc = new MsCreator();
$doc->File = "Ashfaq";
$doc->Type = "Excel";
$doc->Text = "
<table border='1' width='200%'>
<tr bgcolor='white' style='color: red;'>
<TH COLSPAN=6>This Is Testing Excel Sheet Created By Php Ms Word Class Developed By Ashfaq</th>
<th></th>
<th></th>
</tr>
<tr>
<td COLSPAN=6></td>
<td>&nbsp;</td>
<td>&nbsp;</td>

</tr>
</table>



<table border='1' width='200%'>
<tr bgcolor='gray' style='color: white;'>
<th>#</th>
<th>Name</th>
<th>Description</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
<th></th>
<th></th>
</tr>
<tr>
<td width='100' align='center'>1</td>
<td width='300' align='left'>Php</td>
<td width='300' align='left'>Books</td>
<td width='200' align='center'>3</td>
<td width='200' align='center'>$500</td>
<td width='200' align='center'>$1500</td>
<td>&nbsp;</td>
<td>&nbsp;</td>

</tr>
<tr>
<td width='100' align='center'>2</td>
<td width='300' align='left'>Cds</td>
<td width='300' align='left'>Video Cds</td>
<td width='200' align='center'>500</td>
<td width='200' align='center'>$10</td>
<td width='200' align='center'>$5000</td>
<td>&nbsp;</td>
<td>&nbsp;</td>

</tr>

<tr>
<td width='100' align='center'>3</td>
<td width='300' align='left'>Hard Disks</td>
<td width='300' align='left'>Hd Drives</td>
<td width='200' align='center'>2</td>
<td width='200' align='center'>$800</td>
<td width='200' align='center'>$1600</td>
<td>&nbsp;</td>
<td>&nbsp;</td>

</tr>

<tr>
<td width='100' align='center'>4</td>
<td width='300' align='left'>laptop</td>
<td width='300' align='left'>P4 laptops</td>
<td width='200' align='center'>5</td>
<td width='200' align='center'>$1000</td>
<td width='200' align='center'>$50000</td>
<td>&nbsp;</td>
<td>&nbsp;</td>

</tr>
</table>
";
//$doc->Preview();
$doc->Download();
}
?>

<h3 style='font-family: verdanad;'>Click Below To Test This Class</h3>
<form action="" method="post">
 		<input type="submit" value="  Create Doc  File" name="Doc">
</form>


<form action="" method="post">
 		<input type="submit" value="Create Excel File" name="Excel">
</form>
Return current item: MS Word And Excel