TemplNET.TemplDoc.Commit C# (CSharp) Méthode

Commit() public méthode

Save to internal memory. Initialising a *new* stream is important due to the internal structure of DocX's load/save.
public Commit ( ) : TemplDoc
Résultat TemplDoc
        public TemplDoc Commit()
        {
            Stream = new MemoryStream();
            Docx.SaveAs(Stream);
            return this;
        }
        /// <summary>

Usage Example

Exemple #1
0
 /// <summary>
 /// Builds the document, using the provided <paramref name="model"/>.
 /// <para/><see cref="ActiveModules"/> are applied to the document in sequence.
 /// <para/>Enabling <paramref name="debug"/> stores intermediate states after each module.
 /// </summary>
 /// <seealso cref="Debugger"/>
 ///
 public Templ Build(object model, bool debug = TemplConst.Debug, HandleFailAction modelEntryFailAction = HandleFailAction.exception)
 {
     if (debug)
     {
         Debugger.AddState(Document, "Init");
     }
     ActiveModules.ForEach(module =>
     {
         module.Build(Document.Docx, model, modelEntryFailAction);
         if (debug && module.Used)
         {
             Debugger.AddState(Document, module.Name);
         }
     });
     if (debug)
     {
         Debugger.AddModuleReport(ActiveModules);
     }
     Document.Commit();
     Debugger.Commit();
     return(this);
 }