php创建读取 word.doc文档

 创建文档;

start();

		$wordname = 'xxxx'.$i.".doc";
		echo $html;
		$word->save($wordname);
		ob_flush();
		flush();
	}
	
	class word
{
	function start()
	{
	ob_start();
	echo '';
	}
	function save($path)
	{
	 
	echo "";
	$data = ob_get_contents();
	ob_end_clean();
	 
	$this->wirtefile ($path,$data);
	}
 
	function wirtefile ($fn,$data)
	{
	$fp=fopen($fn,"wb");
	fwrite($fp,$data);
	fclose($fp);
	}
}
?>

  读取文档

Documents->Open(realpath("Sample.doc")); 

// Extract content. 
$content = (string) $word->ActiveDocument->Content; 

echo $content; 

$word->ActiveDocument->Close(false); 

$word->Quit(); 
$word = null; 
unset($word); 
?>

  

你可能感兴趣的:(php创建读取 word.doc文档)