//
// 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 character styles
public class BuiltInCharStyles
{
public GcWordDocument CreateDocx()
{
var doc = new GcWordDocument();
var pars = doc.Body.Paragraphs;
pars.Add("Demo of All Built-in Character 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.Character)
continue;
pars.Add().GetRange().Runs.Add($"Text formatted using built-in character style '{style.Name}'.", style);
}
// Done:
return doc;
}
}
}