BuiltInParaStyles.cs
//
// This code is part of Document Solutions for Word demos.
// Copyright (c) MESCIUS inc. All rights reserved.
//
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using GrapeCity.Documents.Word;
using GrapeCity.Documents.Imaging;

namespace DsWordWeb.Demos
{
    // Demo of all built-in paragraph styles.
    public class BuiltInParaStyles
    {
        public GcWordDocument CreateDocx()
        {
            var doc = new GcWordDocument();
            var pars = doc.Body.Paragraphs;

            pars.Add("Demo of All Built-in Paragraph Styles", doc.Styles[BuiltInStyleId.Title]);

            foreach (BuiltInStyleId id in Enum.GetValues(typeof(BuiltInStyleId)))
            {
                if (id == BuiltInStyleId.User)
                    continue;
                var style = doc.Styles[id];
                if (style.Type != StyleType.Paragraph)
                    continue;
                pars.Add($"Paragraph formatted using built-in paragraph style ' {style.Name}'.", style);
            }

            // Done:
            return doc;
        }
    }
}