LoadDocx.cs
C# VB
//// This code is part of Document Solutions for Word demos.// Copyright (c) MESCIUS inc. All rights reserved.//using System.IO;using GrapeCity.Documents.Word;
namespace DsWordWeb.Demos{ // This sample shows how to load an existing DOCX file into DsWord. // It also appends a short note to the end of the loaded document. public class LoadDocx { public GcWordDocument CreateDocx() { var doc = new GcWordDocument();
// Load an existing DOCX file: var path = Path.Combine("Resources", "WordDocs", "JsFrameworkExcerpt.docx"); doc.Load(path);
// Add a note at the end of the document: doc.Body.Sections.Last.GetRange().Paragraphs.Add($"Loaded into DsWord on {Util.TimeNow():R}.");
// Done: return doc; } }}