本文整理汇总了C#中Novacode.DocX.SaveAs方法的典型用法代码示例。如果您正苦于以下问题:C# DocX.SaveAs方法的具体用法?C# DocX.SaveAs怎么用?C# DocX.SaveAs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Novacode.DocX
的用法示例。
在下文中一共展示了DocX.SaveAs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TemplBuilder
/// <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;
}
示例2: Main
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");
}
}
示例3: SaveDoc
private void SaveDoc(DocX doc, string dir, string fileName)
{
doc.SaveAs(dir + fileName);
}
示例4: TemplDoc
/// <summary>
/// New document from filename
/// </summary>
/// <param name="filename"></param>
public TemplDoc(string filename)
{
Filename = filename;
Docx = DocX.Load(Filename);
Docx.SaveAs(Stream);
}