LoadDocx.cs
//
// This code is part of GrapeCity Documents for Word samples.
// Copyright (c) GrapeCity, Inc. All rights reserved.
//
using System;
using System.IO;
using System.Drawing;
using GrapeCity.Documents.Word;

namespace GcWordWeb.Samples
{
    // This sample shows how to load an existing DOCX file into GcWord.
    // 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 GcWord on {DateTime.Now}.");

            // Done:
            return doc;
        }
    }
}