array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'compersisthelper.savetofile.php', 1 => 'COMPersistHelper::SaveToFile', ), 'up' => array ( 0 => 'class.compersisthelper.php', 1 => 'COMPersistHelper', ), 'prev' => array ( 0 => 'compersisthelper.loadfromstream.php', 1 => 'COMPersistHelper::LoadFromStream', ), 'next' => array ( 0 => 'compersisthelper.savetostream.php', 1 => 'COMPersistHelper::SaveToStream', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/com/compersisthelper/savetofile.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5, PHP 7, PHP 8)
COMPersistHelper::SaveToFile — オブジェクトをファイルに保存する
オブジェクトのコピーを指定されたファイルに保存します
関連付けられたオブジェクトが COM のインターフェイス IPersistFile を実装していないか、 IPersistFile::Save() の呼び出しに失敗した場合、 com_exception がスローされます。
例1 COMPersistHelper::saveToFile() の基本的な使い方
<?php
$word = new COM('Word.Application');
$doc = $word->Documents->Add();
$ph = new COMPersistHelper($doc);
$ph->SaveToFile('C:\\Users\\cmb\\Documents\\my.docx');
$word->Quit();
?>