SaveAs() public method

Save this document to a Stream.
public SaveAs ( Stream stream ) : void
stream Stream The Stream to save this document to.
return void
Esempio n. 1
0
 /// <summary>
 /// Start with filename
 /// </summary>
 /// <param name="filename"></param>
 /// <param name="defaultModules"></param>
 public TemplBuilder(string filename, bool defaultModules = true)
     : this(defaultModules)
 {
     Doc = DocX.Load(filename);
     Doc.SaveAs(Stream);
     Filename = filename;
 }
Esempio n. 2
0
 /// <summary>
 /// Start with passed-in doc
 /// </summary>
 /// <param name="document"></param>
 /// <param name="defaultModules"></param>
 public TemplBuilder(DocX document, bool defaultModules = true)
     : this(defaultModules)
 {
     Doc = document;
     Doc.SaveAs(Stream);
 }
Esempio n. 3
0
        static void Main(string[] args)
        {
            // Store a global reference to the executing assembly.
            g_assembly = Assembly.GetExecutingAssembly();

            // Try to load the template 'InvoiceTemplate.docx'.
            try
            {
                // Store a global reference to the loaded document.
                g_document = DocX.Load(@"Content/letterheadpad_template.docx");

                /*
                 * The template 'InvoiceTemplate.docx' exists,
                 * so lets use it to create an invoice for a factitious company
                 * called "The Happy Builder" and store a global reference it.
                 */
                g_document = CreateInvoiceFromTemplate(DocX.Load(@"Content/letterheadpad_template.docx"));

                // Save all changes made to this template as Invoice_The_Happy_Builder.docx (We don't want to replace InvoiceTemplate.docx).
                g_document.SaveAs("Report_print.docx");
            }

            // The template 'InvoiceTemplate.docx' does not exist, so create it.
            catch (FileNotFoundException)
            {
                // Create a store a global reference to the template 'InvoiceTemplate.docx'.
                Console.WriteLine("FILE NOT FOUNDDDDDDDDDDDDDDDDDDDDDDDD");

            }
        }
Esempio n. 4
0
 private void SaveDoc(DocX doc, string dir, string fileName)
 {
     doc.SaveAs(dir + fileName);
 }
Esempio n. 5
0
 /// <summary>
 /// New document from filename
 /// </summary>
 /// <param name="filename"></param>
 public TemplDoc(string filename)
 {
     Filename = filename;
     Docx = DocX.Load(Filename);
     Docx.SaveAs(Stream);
 }
Esempio n. 6
0
 /// <summary>
 /// Start with passed-in doc
 /// </summary>
 /// <param name="document"></param>
 public TemplDoc(DocX document)
 {
     Docx = document;
     Docx.SaveAs(Stream);
 }