$instance = new com(string "component name", string "remote_server_address");
?>
注意:这是用dcom指令来设置php。在将来,php开发者提供unix下对dcom的支持。
标识、方法和属性
标识是一个如下的字串:
ms word: "word.application" or "word.application.9" ms excel: "excel.application" or "excel.sheet" adobe acrobat: "exch.application" or "pdfdistiller.pdfdistiller"
# 读写一个单元格在一个新的工作表中 # 我们可以读到这个单元格 e11 (advertising in the 4th. quarter) $sheets = $wkb->worksheets($sheet); #select the sheet $sheets->activate; #activate it $cell = $sheets->cells(11,5) ; #select the cell (row column number) $cell->activate; #activate the cell print "old value = {$cell->value} "; #print the value of the cell:10000 $cell->value = 15000; #change it to 15000 print "new value = {$cell->value} ";#print the new value=15000
#最后,用新值重新计算这个单元格 $sheets->calculate; #必须的如果要计算,手动则是可选的 #可看到效果总价值(e13单元格) $cell = $sheets->cells(13,5) ; #select the cell (row column number) $number = number_format($cell->value); print "new total cost =$$number - was $47,732 before. "; #根据计算公式,广告影响了公司的开销,这里将显示 $57,809