用COM函数操作  MS  Word    
<?php    
 
 
#实例化一个对象    
 
$word  =  new  COM("word.application")  or  die("Unable  to  instantiate  Word");    
 
#取得并显示版本    
 
print  "Loaded  Word,  version  {$word->Version}<BR>";    
 
#另一种方法去取得版本    
 
$testversion  =  com_get($word->application,version);    
 
print  "Version  using  Com_get():  $testversion  <BR>";    
 
#使其可见    
 
$word->Visible  =  1;    
 
#创建新文件    
 
$word->Documents->Add();    
 
#写字符    
 
$word->Selection->TypeText("This  is  a  test...");    
 
#保存    
 
$word->Documents[1]->SaveAs("Useless  test.doc");    
 
#关闭    
 
$word->Quit();    
 
?>    

解决方案 »

  1.   

    EXCEL解析器,自已改改吧!
    http://xingtai.51.net/download/PHPExcelParserPro3.0.rar
      

  2.   

    谢谢 DFlyingchen(弱水三千)和 feel8(准备早起的鸟)
    但我想知道怎样读excel那个xls文件里面的字段文档内容
      

  3.   

    生成以下代码,另存为就可以了
    你可以再改改:)
    <html xmlns:o="urn:schemas-microsoft-com:office:office"
            xmlns:x="urn:schemas-microsoft-com:office:excel"
            xmlns="http://www.w3.org/TR/REC-html40">
      <head>
            <meta http-equiv="expires" content="Mon, 06 Jan 1999 00:00:01 GMT">
            <meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
            <!--[if gte mso 9]><xml>
            <x:ExcelWorkbook>
            <x:ExcelWorksheets>
                    <x:ExcelWorksheet>
                    <x:Name></x:Name>
                    <x:WorksheetOptions>
                            <x:DisplayGridlines/>
                    </x:WorksheetOptions>
                    </x:ExcelWorksheet>
            </x:ExcelWorksheets>
            </x:ExcelWorkbook>
            </xml><![endif]-->  </head>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr><td align="center" class="big6" >Users (except the ones disabled)</td></tr>
     
    <tr><td class="greyborder">
      <table border="1" align="center" width="100%" cellpadding="1" cellspacing="1">
      <tr align="center">
          <td class="TableTopHeader" nowrap>
          Login   </td>
       <td class="TableTopHeader" nowrap>
          Name   </td>
       <td class="TableTopHeader" width="3%" nowrap>
          EMail   </td>
       <td class="TableTopHeader" nowrap>
        Department   </td>
       <td class="TableTopHeader" nowrap>
        Position   </td>
       <td class="TableTopHeader" nowrap width="1%">
         Level   </td>
       <td class="TableTopHeader">Address</td>
       <td class="TableTopHeader">Phone</td>
    </tr>
        <tr  class="even">
         
          <td class="mtlist">&nbsp;joesen</td>
          <td class="mtlist">&nbsp;hong joesen</td>
          <td class="mtlist" >[email protected]</td>
          <td class="mtlist">&nbsp;Software developments</td>
          <td class="mtlist">&nbsp;System Administrator</td>
          <td class="mtlist">&nbsp;Admin</td>
         
          
          <td class="mtlist">&nbsp;</td>
          <td class="mtlist">&nbsp;</td>
      </tr>
      </table>
    </td></tr>  
    </table>