class Excel
{
static $instance=null;
private $excel=null;
private $workbook=null;
private $workbookadd=null;
private $worksheet=null;
private $worksheetadd=null;
private $sheetnum=1;
private $cells=array();
private $fields=array();
private $maxrows;
private $maxcols;
private $filename;
//构造函数
private function Excel()
{
$this->excel = new COM(“Excel.Application”) or die(“Error:#1″);
}
//类入口
public static function getInstance()
{
if(null == self::$instance)
{
self::$instance = new Excel();
}
return self::$instance;
}
Continue reading »
代码如下,
// 建立一个指向新COM组件的索引
$word = new COM(“word.application”) or die(“Can’t start Word!”);
// 显示目前正在使用的Word的版本号
echo “Loading Word, v. {$word->Version}
“;
exit;
?>
有时候你会得到一个错误,
PHP Fatal error: Uncaught exception ‘com_exception’ with message ‘Failed
to create COM object `word.application’: 拒绝访问. ‘
解决方法:
Continue reading »

Recent Comments