本帖最后由 xlbcwn 于 2011-4-16 13:24 编辑
请问怎样在word文档中插入表格,或者将一文档内容完全插入到另一文档中?谢了!
顺便补充一下:那个码我看不太懂,我想做一个可以插入表格的函数,请问能帮我改改吗?Func charubiaoge($hangshu,$lieshu,$neirong,$objdoc)
$objRange = $objDoc.Range()
$objDoc.Tables.Add($objRange,$hangshu,$lieshu)
$objTable = $objDoc.Tables(1)
For $hang = 1 To $hangshu
For $lie = 1 To $lieshu
$objTable.Cell($hang,$lie).Range.Text = $neirong[$hang][$lie]
Next
Next
EndFunc
Func zengjiabiaoge($hangstart,$hangshu,$liestart,$lieshu,$neirong,$objdoc)
$objRange = $objDoc.Range()
$objDoc.Tables.Add($objRange,$hangshu,$lieshu)
$objTable = $objDoc.Tables(1)
For $hang = 1 To $hangshu
For $lie = 1 To $lieshu
$objTable.Cell($hang + $hangstart,$lie + $liestart).Range.Text = $neirong[$hang][$lie]
Next
Next
EndFunc
#include <Word.au3>
$w1 = _WordCreate(@ScriptDir & "\a.doc",0,0)
$w3 = _WordDocGetCollection($w1,0)
Dim $1[11][11]
For $2 = 1 To 10
For $3 = 1 To 10
$1[$2][$3] = $2 * $3
Next
Next
charubiaoge(10,10,$1,$w3)
zengjiabiaoge(10,10,0,10,$1,$w3)
_WordDocSave($w3)
_WordDocClose($w3)
_WordQuit($w1)
|