array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), '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' => 'en', '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 — Save object to file
Saves a copy of the object to the specified file.
filename
remember
filename
parameter is to be used as the current
working file. If true
, filename
becomes the current file and the
object is supposed to clear its dirty flag after the save. If false
, this save operation is
a "Save A Copy As ..." operation. In this case, the current file is unchanged and the object
is not supposed to clear its dirty flag.
A com_exception is thrown if the associated object does not implement the COM interface IPersistFile, or when calling the IPersistFile::Save() method failed.
Exemple #1 Basic COMPersistHelper::saveToFile() Usage
<?php
$word = new COM('Word.Application');
$doc = $word->Documents->Add();
$ph = new COMPersistHelper($doc);
$ph->SaveToFile('C:\\Users\\cmb\\Documents\\my.docx');
$word->Quit();
?>