<?php
$word = new COM("word.application") or die("无法启动 Word 程序!");$word->Visible = 1;
$doc = $word->Documents->Add();$doc->Sections->Add($word->Selection->Range,0);// 增加一个分节
$Section = $doc->Sections(1); // 获取第一小节对象
$Range   = $Section->Range;   // 产生 Range 对象
$Table   = $doc->Tables->Add($Range ,5, 10); // 产生 5x10的表格// 将数据塞入表格
for ($i=1; $i<=10; $i++) {
    for ($j=1; $j<=5; $j++) {
        $Cell      = $Table->Cell($j, $i);
        $CellRange = $Cell->Range;
        $CellRange->InsertBefore(chr(0x40+$j).chr(0x40+$i));
    }
}$word->Documents[1]->SaveAs("c:\\word.doc");
$word->Quit();
$word->Release();
$word = null;
?>

解决方案 »

  1.   

    <img src="test.jpg" /> 写word时把这个直接写就行,word里能识别html
      

  2.   

    这个不行,我必须把图片导入到DOC 中,就算是没有网络的情况下用户还是可以看到图片
    如果用<img src="test.jpg" />    用户在没有网络的情况,这种外链图是看不到的,多谢楼上..解答
      

  3.   

    如何把图片导入到DOC 中 不用外链的方式