<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.compersisthelper.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'compersisthelper.savetofile.php',
    1 => 'COMPersistHelper::SaveToFile',
    2 => 'Save object to file',
  ),
  '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',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="compersisthelper.savetofile" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">COMPersistHelper::SaveToFile</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">COMPersistHelper::SaveToFile</span> &mdash; <span class="dc-title">Save object to file</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-compersisthelper.savetofile-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><strong>COMPersistHelper::SaveToFile</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$filename</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$remember</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></span></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Saves a copy of the object to the specified file.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-compersisthelper.savetofile-parameters">
  <h3 class="title">Parameters</h3>
  <dl>
   
    <dt><code class="parameter">filename</code></dt>
    <dd>
     <span class="simpara">
      The name of the file to which to save the object.
     </span>
    </dd>
   
   
    <dt><code class="parameter">remember</code></dt>
    <dd>
     <span class="simpara">
      Indicates whether the <code class="parameter">filename</code> parameter is to be used as the current
      working file. If <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, <code class="parameter">filename</code> becomes the current file and the
      object is supposed to clear its dirty flag after the save. If <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>, this save operation is
      a &quot;Save A Copy As ...&quot; operation. In this case, the current file is unchanged and the object
      is not supposed to clear its dirty flag.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-compersisthelper.savetofile-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> on success or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-compersisthelper.savetofile-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   A <span class="classname"><a href="class.com-exception.php" class="classname">com_exception</a></span> is thrown if the associated object does not
   implement the <abbr>COM</abbr> interface <span class="interfacename"><strong class="interfacename">IPersistFile</strong></span>,
   or when calling the <span class="methodname"><strong>IPersistFile::Save()</strong></span> method failed.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-compersisthelper.savetofile-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="compersisthelper.savetofile.example.basic">
   <p><strong>Example #1 Basic <span class="methodname"><strong>COMPersistHelper::saveToFile()</strong></span> Usage</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$word </span><span style="color: #007700">= new </span><span style="color: #0000BB">COM</span><span style="color: #007700">(</span><span style="color: #DD0000">'Word.Application'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$doc </span><span style="color: #007700">= </span><span style="color: #0000BB">$word</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Documents</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Add</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$ph </span><span style="color: #007700">= new </span><span style="color: #0000BB">COMPersistHelper</span><span style="color: #007700">(</span><span style="color: #0000BB">$doc</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$ph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">SaveToFile</span><span style="color: #007700">(</span><span style="color: #DD0000">'C:\\Users\\cmb\\Documents\\my.docx'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$word</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Quit</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


</div><?php manual_footer($setup); ?>