diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..27976b6
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,13 @@
+################################################################################
+# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
+################################################################################
+
+/Xceed.Document.NET/obj
+/.vs
+/Xceed.Words.NET/obj/Debug
+/Xceed.Words.NET/obj/Release
+/Xceed.Words.NET.Examples/obj
+/Xceed.Document.NET/bin/Debug
+/Xceed.Words.NET/bin/Debug
+/Xceed.Words.NET.Examples/bin/Debug
+*.user
diff --git a/README.md b/README.md
index 901ff2a..fd2dfd9 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,17 @@
+## Changes in this fork
+
+This fork/branch includes several changes that were introduced in support of a project to generate "Register Format" reports from GEDCOM files. This use-case anticipates that the output document is to be processed programatically just once, when it is created, and will be subsequently edited manually.
+
+The changes include:
+
+* Character Styles: if the format object passed when appending text to a paragraph includes a style name (id) it is applied to the text as a character style (in the base version, it is simply ignored)
+* Indexing: supports inserting index entries (XE fields) into paragraphs and indexes (INDEX fields). Features supported include "type" (used to separate e.g. name index from place index)
+* Footnotes/Endnotes: supports inserting footnotes and/or endnotes into paragraphs. Notes can include hyperlinks and can include references to other notes (of the same flavor). NB: This is a "one-way" capability: existing Notes (including ones just added using this feature) cannot be modified and cannot be deleted (except, of course, by hand in an editor).
+
+Simple examples of footnotes, endnotes, and indexes are provided.
+
+Full, unedited text of the base project readme follows.
+
## What is DocX?
DocX is a .NET library that allows developers to manipulate Word 2007/2010/2013 files, in an easy and intuitive manner. DocX is fast, lightweight and best of all it does not require Microsoft Word or Office to be installed.
diff --git a/Xceed.Document.NET/Src/AbstractField.cs b/Xceed.Document.NET/Src/AbstractField.cs
new file mode 100644
index 0000000..cd77175
--- /dev/null
+++ b/Xceed.Document.NET/Src/AbstractField.cs
@@ -0,0 +1,94 @@
+using System.Xml.Linq;
+
+namespace Xceed.Document.NET
+{
+ public abstract class AbstractField : DocumentElement
+ {
+ //public AbstractField(Document doc) : base(doc, null) { }
+
+ //public XElement Xml { get; internal set; }
+
+ ///
+ /// Wrap the supplied arbitrary text of the field, in the field begin and
+ /// end markers in a run.
+ ///
+ /// the field Id and any parameters needed, NO CHECKING is done
+ ///
+ /// XML with the run representing the field
+ internal XElement Build(string fieldText, string fieldContent = null)
+ {
+ // to unravel the nesting, build the inner parts in an array first
+ object[] parts = new object[(fieldContent==null)?3:5];
+ int next = 0;
+
+ parts[next++] = new XElement
+ (
+ XName.Get("r", Document.w.NamespaceName),
+ new XElement
+ (
+ XName.Get("fldChar", Document.w.NamespaceName),
+ new XAttribute(Document.w + "fldCharType", "begin")
+ )
+ );
+
+
+ parts[next++] = new XElement
+ (
+ XName.Get("r", Document.w.NamespaceName),
+ new XElement
+ (
+ XName.Get("instrText", Document.w.NamespaceName),
+ new XAttribute(XNamespace.Xml + "space", "preserve"),
+ fieldText
+ )
+ );
+
+ // additional text e.g. for a hyperlink inserted for the field
+ // entails two runs, one for a separator and the second for the text
+ if (fieldContent != null)
+ {
+ parts[next++] = new XElement
+ (
+ XName.Get("r", Document.w.NamespaceName),
+ new XElement
+ (
+ XName.Get("fldChar", Document.w.NamespaceName),
+ new XAttribute(Document.w + "fldCharType", "separate")
+ )
+ );
+ parts[next++] = new XElement
+ (
+ XName.Get("r", Document.w.NamespaceName),
+ new XElement
+ (
+ XName.Get("t", Document.w.NamespaceName),
+ fieldContent
+ )
+ );
+ }
+
+ parts[next] = new XElement
+ (
+ XName.Get("r", Document.w.NamespaceName),
+ new XElement
+ (
+ XName.Get("fldChar", Document.w.NamespaceName),
+ new XAttribute(Document.w + "fldCharType", "end")
+ )
+ );
+
+ // then wrap them all up in a run, and we are done
+ XElement xe = new XElement
+ (
+ XName.Get("r", Document.w.NamespaceName),
+ parts
+ );
+
+ return Xml = xe;
+ }
+
+ public abstract AbstractField Build();
+
+ protected AbstractField(Document document, XElement xml) : base(document, xml) { }
+ }
+}
diff --git a/Xceed.Document.NET/Src/Document.cs b/Xceed.Document.NET/Src/Document.cs
index 90a2bc8..ea389fd 100644
--- a/Xceed.Document.NET/Src/Document.cs
+++ b/Xceed.Document.NET/Src/Document.cs
@@ -89,11 +89,17 @@ public class Document : Container, IDisposable
"image/wmf"
};
+ // when using foot/end notes in a new document, the entire part and/or the
+ // referenced styles may be missing, checking is not cheap, so, keep track of
+ // having checked so we only need to do it once per doc instead of per-note
+ private bool _footnoteDefaultsChecked;
+ private bool _endnoteDefaultsChecked;
+
#endregion
- #region Internal Constants
+ #region Internal Constants
- internal const string RelationshipImage = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
+ internal const string RelationshipImage = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
internal const string ContentTypeApplicationRelationShipXml = "application/vnd.openxmlformats-package.relationships+xml";
#endregion
@@ -870,6 +876,157 @@ public IEnumerable FootnotesText
}
}
+ public Hyperlink AddHyperlinkToFootnotes(string text, Uri uri, string anchor = null, Hyperlink baseHyperlink = null, Formatting formatting = null)
+ {
+ return AddHyperlinkToPackagePart(_footnotesPart, text, uri, anchor??text, baseHyperlink, formatting);
+ }
+
+ public Hyperlink AddHyperlinkToEndnotes(string text, Uri uri, string anchor = null, Hyperlink baseHyperlink = null, Formatting formatting = null)
+ {
+ return AddHyperlinkToPackagePart(_endnotesPart, text, uri, anchor??text, baseHyperlink, formatting);
+ }
+
+ public Hyperlink AddHyperlinkToPackagePart(PackagePart pp, string text, Uri uri, string anchor, Hyperlink baseHyperlink = null, Formatting formatting = null)
+ {
+ // Convert the path of this Part to its equivalent rels file path.
+ string ppPath = pp.Uri.OriginalString;
+ string ppName = ppPath.Substring(ppPath.IndexOf('/', 1)+1);
+ var rels_path = new Uri("/word/_rels/" + ppName + ".rels", UriKind.Relative);
+
+ // Check to see if the rels file exists and create it if not.
+ if (!Document._package.PartExists(rels_path))
+ {
+ HelperFunctions.CreateRelsPackagePart(Document, rels_path);
+ }
+
+ Hyperlink h = AddHyperlinkCore(text, uri, anchor, baseHyperlink, formatting, pp);
+
+ // Check to see if a rel for this Hyperlink exists, create it if not.
+ string hid = Paragraph.GetOrGenerateRel(h, pp);
+
+ h.Xml.SetAttributeValue(Document.r + "id", hid);
+
+ return h;
+
+ }
+ public bool AppendFootnote(XElement footnoteElement)
+ {
+ if (footnoteElement?.Name.LocalName != "footnote")
+ throw new ArgumentException("argument is not a footnote");
+
+ VerifyFootnoteContext();
+
+ _footnotes.Document?.Root?.Add(footnoteElement);
+ return true;
+ }
+
+ public bool HasNonDefaultFootnotes() => _footnotes != null && MaxFootnoteId() >= 1;
+ public bool HasNonDefaultEndnotes() => _endnotes != null && MaxEndnoteId() >= 1;
+
+ internal void VerifyFootnoteContext()
+ {
+ if (_footnoteDefaultsChecked) return;
+
+ // If this document does not contain a footnotesPart create one.
+ var fileUri = new Uri("/word/footnotes.xml", UriKind.Relative);
+ if (!_package.PartExists(fileUri))
+ {
+ _footnotes = HelperFunctions.AddDefaultFootnotesXml(this, _package, ref _footnotesPart);
+ }
+ HelperFunctions.EnsureDefaultFootnoteStyles(this);
+ _footnoteDefaultsChecked = true;
+ }
+
+ ///
+ /// Check the current styles and add any of the 'wanted' that are not currently defined
+ ///
+ /// styles to add if not defined
+ /// count of styles added
+ public int VerifyOrAddStyles(List wanted)
+ {
+ if ((wanted?.Count ?? 0) <= 0) return 0;
+
+ int rv = 0;
+ var stylesElement = _styles.Element(XName.Get("styles", Document.w.NamespaceName));
+
+ var ids = (from d in stylesElement.Descendants(XName.Get("style", Document.w.NamespaceName))
+ let a = d.Attribute(XName.Get("styleId", Document.w.NamespaceName))
+ where a != null
+ select a.Value).ToList();
+
+ foreach (XElement style in wanted)
+ {
+ string wantedId = style.Attribute(XName.Get("styleId", Document.w.NamespaceName))?.Value;
+ if (string.IsNullOrEmpty(wantedId) || ids.Contains(wantedId)) continue;
+ stylesElement.Add(style);
+ rv++;
+ }
+
+ return rv;
+ }
+
+ public List ListStyles()
+ {
+ List rvl = new List();
+
+ if (_styles == null) return rvl;
+ var stylesElement = _styles.Element(XName.Get("styles", Document.w.NamespaceName));
+ foreach (XElement style in stylesElement.Descendants(XName.Get("style", Document.w.NamespaceName)))
+ {
+ string id = style.Attribute(XName.Get("styleId", Document.w.NamespaceName))?.Value;
+ string tipe = style.Attribute(XName.Get("type", Document.w.NamespaceName))?.Value;
+ string name = style.Descendants(XName.Get("name", Document.w.NamespaceName))
+ .FirstOrDefault()?.Attribute(XName.Get("val", Document.w.NamespaceName))?.Value;
+ rvl.Add(new StyleInfo(){Id = id, Name = name, StyleType = tipe});
+ }
+
+ return rvl;
+ }
+ public class StyleInfo
+ {
+ public string Name { get; set; }
+ public string Id { get; set; }
+ public string StyleType { get; set; }
+ }
+
+ public bool AppendEndnote(XElement endnoteElement)
+ {
+ if (endnoteElement?.Name.LocalName != "endnote")
+ throw new ArgumentException("argument is not an endnote");
+
+ VerifyEndnoteContext();
+
+ _endnotes.Document?.Root?.Add(endnoteElement);
+
+ return true;
+ }
+
+ public bool AppendEndnote(DocumentElement endnoteElement)
+ {
+
+ VerifyEndnoteContext();
+
+ _endnotes.Add(endnoteElement);
+
+ return true;
+ }
+
+
+
+ internal void VerifyEndnoteContext()
+ {
+ if (_endnoteDefaultsChecked) return;
+
+ // If this document does not contain a endnotesPart create one.
+ var fileUri = new Uri("/word/endnotes.xml", UriKind.Relative);
+ if (!_package.PartExists(fileUri))
+ {
+ _endnotes = HelperFunctions.AddDefaultEndnotesXml(this, _package, ref _endnotesPart);
+ }
+ HelperFunctions.EnsureDefaultEndnoteStyles(this);
+ _endnoteDefaultsChecked = true;
+ }
+
///
/// Get the Endnotes of this document
///
@@ -1840,7 +1997,7 @@ public void ApplyTemplate( Stream templateStream, bool includeContent )
{
PackagePart documentPart = null;
XDocument documentDoc = null;
- foreach( PackagePart packagePart in templatePackage.GetParts() )
+ foreach ( PackagePart packagePart in templatePackage.GetParts() )
{
switch( packagePart.Uri.ToString() )
{
@@ -1877,6 +2034,19 @@ public void ApplyTemplate( Stream templateStream, bool includeContent )
case "/word/_rels/document.xml.rels":
break;
default:
+ //if (!includeContent)
+ //{
+ // // footnotes and endnotes are "content" too...
+ // // and it creates an invalid document to merge them in but delete the
+ // // paragraphs with the related elements. here, we "should" either not merge them
+ // // or else delete them. but this gets complicated e.g. the relationship,
+ // // valid notes we already had, etc. At this point, "punting" on this issue
+ // // user can first load the merging doc and check/warn using HasNonDefaultFootnotes()
+ // //
+ // // just skipping, as below, quickly fails:
+ // if (packagePart.Uri.ToString() == "/word/footnotes.xml" || packagePart.Uri.ToString() == "/word/endnotes.xml")
+ // break;
+ //}
if( !_package.PartExists( packagePart.Uri ) )
{
_package.CreatePart( packagePart.Uri, packagePart.ContentType, packagePart.CompressionOption );
@@ -3157,9 +3327,10 @@ select s
word_styles.Element( w + "styles" ).Add( style );
// Save the styles document.
- using( TextWriter tw = new StreamWriter( new PackagePartStream( _package.GetPart( word_styles_Uri ).GetStream() ) ) )
+ //using (TextWriter tw = new StreamWriter(new PackagePartStream(_package.GetPart(word_styles_Uri).GetStream())))
+ using (TextWriter tw = new StreamWriter(new PackagePartStream(_stylesPart.GetStream())))
{
- word_styles.Save( tw );
+ word_styles.Save( tw );
}
}
}
@@ -3984,14 +4155,7 @@ select int.Parse( d.Attribute( XName.Get( "id", w.NamespaceName ) ).Value )
private void merge_footnotes( PackagePart remote_pp, PackagePart local_pp, XDocument remote_mainDoc, Document remote, XDocument remote_footnotes )
{
- IEnumerable ids =
- (
- from d in _footnotes.Root.Descendants()
- where d.Name.LocalName == "footnote"
- select int.Parse( d.Attribute( XName.Get( "id", Document.w.NamespaceName ) ).Value )
- );
-
- int max_id = ids.Max() + 1;
+ var max_id = MaxFootnoteId()+1;
var footnoteReferences = remote_mainDoc.Descendants( XName.Get( "footnoteReference", Document.w.NamespaceName ) );
foreach( var footnote in remote_footnotes.Root.Elements().OrderBy( fr => fr.Attribute( XName.Get( "id", Document.r.NamespaceName ) ) ).Reverse() )
@@ -4020,6 +4184,20 @@ select int.Parse( d.Attribute( XName.Get( "id", Document.w.NamespaceName ) ).Val
}
}
+ public int MaxFootnoteId()
+ {
+ VerifyFootnoteContext();
+ int rv = int.Parse((_footnotes?.Root?.LastNode as XElement)?.Attribute(XName.Get("id", Document.w.NamespaceName))?.Value ??"0");
+ return rv;
+ }
+
+ public int MaxEndnoteId()
+ {
+ VerifyEndnoteContext();
+ int rv = int.Parse((_endnotes?.Root?.LastNode as XElement)?.Attribute(XName.Get("id", Document.w.NamespaceName))?.Value ??"0");
+ return rv;
+ }
+
private void merge_customs( PackagePart remote_pp, PackagePart local_pp, XDocument remote_mainDoc )
{
// Get the remote documents custom.xml file.
@@ -4711,13 +4889,9 @@ private byte[] MergeArrays( byte[] array1, byte[] array2 )
- private Hyperlink AddHyperlinkCore( string text, Uri uri, string anchor, Hyperlink baseHyperlink, Formatting formatting )
+ private Hyperlink AddHyperlinkCore( string text, Uri uri, string anchor, Hyperlink baseHyperlink, Formatting formatting, PackagePart targetPackagePart = null )
{
XElement xElement = null;
-
-
-
-
{
xElement = new XElement
(
@@ -4733,7 +4907,7 @@ private Hyperlink AddHyperlinkCore( string text, Uri uri, string anchor, Hyperli
);
}
- var h = new Hyperlink( this, this.PackagePart, xElement );
+ var h = new Hyperlink( this, targetPackagePart ?? this.PackagePart, xElement );
h.text = text;
if( uri != null )
{
diff --git a/Xceed.Document.NET/Src/Endnote.cs b/Xceed.Document.NET/Src/Endnote.cs
new file mode 100644
index 0000000..b2cfe1e
--- /dev/null
+++ b/Xceed.Document.NET/Src/Endnote.cs
@@ -0,0 +1,37 @@
+using System;
+
+namespace Xceed.Document.NET.Src
+{
+ public class Endnote : Footnote
+ {
+
+ public static string DefaultEndnoteStyle { get; set; } = "EndnoteText";
+ public static string DefaultEndnoteRefStyle { get; set; } = "EndnoteReference";
+
+
+ public Endnote(Document document, string noteText = null, string[] brackets = null) : base(document, null)
+ {
+ NoteReferenceStyle = DefaultEndnoteRefStyle;
+ NoteTextStyle = DefaultEndnoteStyle;
+ NoteReferenceNode = "endnoteReference";
+ NoteRefNode = "endnoteRef";
+ NoteNode = "endnote";
+
+ Init(document, noteText, brackets);
+
+ }
+ internal override void AssignNextId()
+ {
+ id = (doc.MaxEndnoteId() + 1);
+ }
+ internal override bool ApplyToDocument()
+ {
+ return doc.AppendEndnote(noteElement);
+ }
+ internal override Hyperlink BuildHyperlink(Fragment fragment)
+ {
+ Hyperlink h = doc.AddHyperlinkToFootnotes(fragment.Content, new Uri(fragment.Content));
+ return h;
+ }
+ }
+}
diff --git a/Xceed.Document.NET/Src/Footnote.cs b/Xceed.Document.NET/Src/Footnote.cs
new file mode 100644
index 0000000..46b9319
--- /dev/null
+++ b/Xceed.Document.NET/Src/Footnote.cs
@@ -0,0 +1,262 @@
+using System;
+using System.Collections.Generic;
+using System.Xml.Linq;
+
+namespace Xceed.Document.NET.Src
+{
+ public class Footnote : DocumentElement
+ {
+ /*
+ *
+ *
+ a complete end/footnote entry is a distinct structure that looks like this (with optional added []s)
+
+
+
+
+
+
+ [
+
+ ]
+
+ This is my footnote.
+
+
+
+ and a reference is a run (with added []s) that looks like this
+
+
+
+
+
+ [
+
+ ]
+
+
+ *
+ *
+ */
+ public enum FragmentType
+ {
+ Text,
+ Noteref,
+ Hyperlink
+ }
+
+ internal class Fragment
+ {
+ public FragmentType Type { get; set; }
+ public string Content { get; set; }
+ public object DataObject { get; set; }
+ }
+
+ public static string BookmarkNamePattern = "_RefN{0}";
+
+ public static string DefaultFootnoteStyle { get; set; } = "FootnoteText";
+ public static string DefaultFootnoteRefStyle { get; set; } = "FootnoteReference";
+
+ public string NoteReferenceStyle { get; internal set; }
+ public string NoteTextStyle { get; internal set; }
+ public string NoteReferenceNode { get; internal set; }
+ public string NoteRefNode { get; internal set; }
+ public string NoteNode { get; internal set; }
+ public bool IsApplied { get; internal set; }
+ public int? Id => IsApplied ? id : (int?) null;
+ public string BookmarkName { get; set; }
+ public int BookmarkId { get; set; }
+ public Footnote ReferenceNote { get; set; }
+ internal List Fragments { get; set; }
+
+ internal Document doc;
+ internal string[] brackets;
+ internal XElement noteElement;
+ internal XElement noteRefElement;
+
+ private int _id;
+
+ internal int id
+ {
+ get => _id;
+ set
+ {
+ if (_id == 0)
+ _id = value;
+ else
+ throw new InvalidOperationException("footnote id is immutable once set");
+ }
+ }
+
+ public Footnote(Document document, string noteText = null, string[] brackets = null) : base(document, null)
+ {
+ NoteReferenceStyle = DefaultFootnoteRefStyle;
+ NoteTextStyle = DefaultFootnoteStyle;
+ NoteReferenceNode = "footnoteReference";
+ NoteRefNode = "footnoteRef";
+ NoteNode = "footnote";
+
+ Init(document, noteText, brackets);
+ }
+
+ internal void Init(Document document, string text, string[] pBrackets)
+ {
+ doc = document;
+ if (!string.IsNullOrEmpty(text))
+ (Fragments = new List()).Add(new Fragment() { Content = text, Type = FragmentType.Text });
+ if (pBrackets == null) return;
+ if (pBrackets.Length != 2)
+ throw new ArgumentException("brackets parameter must be null or two elements");
+ brackets = pBrackets;
+ }
+
+ public Footnote AppendText(string t)
+ {
+ (Fragments ?? (Fragments = new List()))
+ .Add(new Fragment() { Type = FragmentType.Text, Content = t });
+ return this;
+ }
+
+ public Footnote AppendNoteRef(Footnote other)
+ {
+ (Fragments ?? (Fragments = new List()))
+ .Add(new Fragment() { Type = FragmentType.Noteref, DataObject = other});
+ return this;
+ }
+
+ public Footnote AppendHyperlink(string t)
+ {
+ (Fragments ?? (Fragments = new List()))
+ .Add(new Fragment() { Type = FragmentType.Hyperlink, Content = t });
+ return this;
+ }
+
+ internal virtual void AssignNextId()
+ {
+ id = (doc.MaxFootnoteId() + 1);
+ }
+
+ internal virtual bool ApplyToDocument()
+ {
+ Xml = noteElement;
+ return doc.AppendFootnote(noteElement);
+ }
+
+ public void Apply(Paragraph p, bool bookmarked = false)
+ {
+ if (IsApplied)
+ {
+ throw new InvalidOperationException("note has already been applied");
+ }
+ if (Fragments?[0] == null)
+ {
+ throw new InvalidOperationException("note has no content");
+ }
+
+ AssignNextId();
+
+ // create the note element
+ noteElement = new XElement(Document.w + NoteNode, new XAttribute(Document.w + "id", id));
+
+ XElement np = new XElement(Document.w + "p");
+ np.Add(new XElement(Document.w + "pPr", new XElement(Document.w + "pStyle", new XAttribute(Document.w + "val", NoteTextStyle))));
+ noteElement.Add(np);
+
+ XElement r = new XElement(Document.w + "r",
+ new XElement(Document.w + "rPr", new XElement(Document.w + "rStyle", new XAttribute(Document.w + "val", NoteReferenceStyle))));
+ if (brackets != null)
+ r.Add(new XElement(Document.w + "t", brackets[0]));
+ r.Add(new XElement(Document.w + NoteRefNode));
+ if (brackets != null)
+ r.Add(new XElement(Document.w + "t", brackets[1]));
+ np.Add(r);
+
+ // make sure there is separation between the fn# and the contents
+ string space = (Fragments[0].Content ?? "").StartsWith(" ") ? "" : " ";
+ foreach (Fragment fragment in Fragments)
+ {
+ switch (fragment.Type)
+ {
+ case FragmentType.Text:
+ r = new XElement(Document.w + "r", new XElement(Document.w + "t", new XAttribute(XNamespace.Xml + "space", "preserve"), $"{space}{fragment.Content}"));
+ np.Add(r);
+ space = "";
+ break;
+ case FragmentType.Noteref:
+ // insert a bookmark reference back to another foot/endnote
+ // this is limited to the note number, because any other text included
+ // with it will be deleted if/when Word renumbers the notes, e.g. on A, F9
+ if ((ReferenceNote ?? (ReferenceNote = fragment.DataObject as Footnote))?.BookmarkName == null)
+ break;
+ NoteRefField nrf = new NoteRefField(doc, null) { MarkName = ReferenceNote.BookmarkName, ReferenceText = $"{ReferenceNote.Id}", InsertHyperlink = true };
+ np.Add(nrf.Build().Xml);
+ break;
+ case FragmentType.Hyperlink:
+ try
+ {
+ Hyperlink h = BuildHyperlink(fragment);
+ np.Add(h?.Xml);
+ }
+ catch (UriFormatException ufx)
+ {
+ // giving up on it
+ }
+ break;
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
+ }
+
+ // add the xNote to the document's collection
+ if (!ApplyToDocument())
+ return;
+ IsApplied = true;
+
+ ApplyInline(p, bookmarked);
+ }
+
+ internal virtual Hyperlink BuildHyperlink(Fragment fragment)
+ {
+ Hyperlink h = doc.AddHyperlinkToFootnotes(fragment.Content, new Uri(fragment.Content));
+ return h;
+ }
+
+ internal void ApplyInline(Paragraph p, bool bookmarked)
+ {
+ // create the reference element...
+ noteRefElement = new XElement(Document.w + "r",
+ new XElement(Document.w + "rPr",
+ new XElement(Document.w + "rStyle", new XAttribute(Document.w + "val", NoteReferenceStyle))));
+ // ... optionally wrapped in brackets (choose when needed to distinguish footnotes from exponents etc.)
+ if (brackets != null)
+ noteRefElement.Add(new XElement(Document.w + "t", brackets[0]));
+ // optionally wrapped in a bookmark marker
+ if (bookmarked)
+ {
+ BookmarkId = Paragraph.NextBookmarkId;
+ BookmarkName = string.Format(BookmarkNamePattern, BookmarkId);
+ XElement wBookmarkStart = new XElement(
+ XName.Get("bookmarkStart", Document.w.NamespaceName),
+ new XAttribute(XName.Get("id", Document.w.NamespaceName), BookmarkId),
+ new XAttribute(XName.Get("name", Document.w.NamespaceName), BookmarkName));
+ noteRefElement.Add(wBookmarkStart);
+ }
+
+ noteRefElement.Add(new XElement(Document.w + NoteReferenceNode, new XAttribute(Document.w + "id", id)));
+ if (bookmarked)
+ {
+ XElement wBookmarkEnd = new XElement(
+ XName.Get("bookmarkEnd", Document.w.NamespaceName),
+ new XAttribute(XName.Get("id", Document.w.NamespaceName), BookmarkId),
+ new XAttribute(XName.Get("name", Document.w.NamespaceName), BookmarkName));
+ noteRefElement.Add(wBookmarkEnd);
+ }
+
+ if (brackets != null)
+ noteRefElement.Add(new XElement(Document.w + "t", brackets[1]));
+
+ // append the reference run to the paragraph
+ p.Xml.Add(noteRefElement);
+ }
+ }
+}
diff --git a/Xceed.Document.NET/Src/HelperFunctions.cs b/Xceed.Document.NET/Src/HelperFunctions.cs
index 2c18fe4..e8115d4 100644
--- a/Xceed.Document.NET/Src/HelperFunctions.cs
+++ b/Xceed.Document.NET/Src/HelperFunctions.cs
@@ -37,7 +37,7 @@ internal enum ResourceType
NumberingDecimal,
Numbering,
Styles,
- Theme
+ Theme,
}
internal static class HelperFunctions
@@ -464,6 +464,176 @@ internal static string GetResources( ResourceType resType )
return null;
}
+ internal static XDocument AddDefaultFootnotesXml(Document document, Package package, ref PackagePart word_footnotes)
+ {
+ XDocument footnotesDoc;
+ // Create the main document part for this package
+ footnotesDoc = XDocument.Parse
+ (@"
+
+
+
+
+
+
+
+
+
+
+
+ ");
+ word_footnotes = package.CreatePart(new Uri("/word/footnotes.xml", UriKind.Relative), "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", CompressionOption.Maximum);
+
+ // Save /word/footnotes.xml
+ using (TextWriter tw = new StreamWriter(new PackagePartStream(word_footnotes.GetStream(FileMode.Create, FileAccess.Write))))
+ {
+ footnotesDoc.Save(tw, SaveOptions.None);
+ }
+
+ // set up the relationship to the main doc
+ var mainDocumentPart = GetMainDocumentPart(package);
+ mainDocumentPart.CreateRelationship(word_footnotes.Uri, TargetMode.Internal, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes");
+
+ return footnotesDoc;
+ }
+
+ internal static void EnsureDefaultFootnoteStyles(Document document)
+ {
+ // Add the default footnote styles if not already defined
+ XDocument footnoteStyles = XDocument.Parse
+ (@"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ");
+ List wantedStyles =
+ new List(footnoteStyles.Element(XName.Get("styles", Document.w.NamespaceName)).Elements());
+ document.VerifyOrAddStyles(wantedStyles);
+ }
+
+ internal static XDocument AddDefaultEndnotesXml(Document document, Package package, ref PackagePart word_endnotes)
+ {
+ XDocument endnotesDoc;
+ // Create the main document part for this package
+ endnotesDoc = XDocument.Parse
+ (@"
+
+
+
+
+
+
+
+
+
+
+
+ ");
+ word_endnotes = package.CreatePart(new Uri("/word/endnotes.xml", UriKind.Relative), "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml", CompressionOption.Maximum);
+
+ // Save /word/endnotes.xml
+ using (TextWriter tw = new StreamWriter(new PackagePartStream(word_endnotes.GetStream(FileMode.Create, FileAccess.Write))))
+ {
+ endnotesDoc.Save(tw, SaveOptions.None);
+ }
+
+ // set up the relationship to the main doc
+ var mainDocumentPart = GetMainDocumentPart(package);
+ mainDocumentPart.CreateRelationship(word_endnotes.Uri, TargetMode.Internal, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes");
+
+ return endnotesDoc;
+ }
+
+ internal static void EnsureDefaultEndnoteStyles(Document document)
+ {
+ // Add the default endnote styles if not already defined
+ XDocument endnoteStyles = XDocument.Parse
+ (@"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ");
+ List wantedStyles =
+ new List(endnoteStyles.Element(XName.Get("styles", Document.w.NamespaceName)).Elements());
+ document.VerifyOrAddStyles(wantedStyles);
+ }
+
///
/// If this document does not contain a /word/styles.xml add the default one generated by Microsoft Word.
///
diff --git a/Xceed.Document.NET/Src/IndexEntry.cs b/Xceed.Document.NET/Src/IndexEntry.cs
new file mode 100644
index 0000000..5b56ba5
--- /dev/null
+++ b/Xceed.Document.NET/Src/IndexEntry.cs
@@ -0,0 +1,97 @@
+using System.Text;
+using System.Xml.Linq;
+
+namespace Xceed.Document.NET.Src
+{
+ public class IndexEntry : AbstractField
+ {
+ public string IndexValue { get; set; }
+ public string IndexName { get; set; }
+ public string SeeInstead { get; set; }
+
+ public IndexEntry(Document document) : base(document, null) { }
+
+ #region Overrides of AbstractField
+
+ public override AbstractField Build()
+ {
+ // build the contents of the field
+ string fieldContents = $" XE \"{IndexValue}\" ";
+ if (SeeInstead != null)
+ fieldContents = $"{fieldContents}\\t \"See {SeeInstead}\" ";
+ if (IndexName != null)
+ fieldContents = $"{fieldContents}\\f \"{IndexName}\" ";
+
+ // wrap it in the field delimiters
+ Xml = Build(fieldContents);
+ return this;
+ }
+ #endregion
+ }
+
+ ///
+ /// Class to produce the XML for an index field.
+ /// See ECMA-376-1:2016 / Office Open XML File Formats — Fundamentals and Markup Language Reference / October 2016, pages 1220 - 1222
+ ///
+ /// NB several of the less-common options may not have been tested
+ ///
+ ///
+ public class IndexField : AbstractField
+ {
+ public static string UpdateFieldPrompt { get; set; } = "Right-click and Update (this) field to generate the index";
+ public string Bookmark { get; set; }
+ public int Columns { get; set; }
+ public string SequencePageSeparator { get; set; }
+ public string EntryPageSeparator { get; set; }
+ public string IndexName { get; set; }
+ public string PageRangeSeparator { get; set; }
+ public string LetterHeading { get; set; }
+ public string XrefSeparator { get; set; }
+ public string PagePageSeparator { get; set; }
+ public string LetterRange { get; set; }
+ public bool RunSubentries { get; set; }
+ public string SequenceName { get; set; }
+ public bool EnableYomi { get; set; }
+ public string LanguageId { get; set; }
+
+
+
+ public IndexField(Document document, XElement xml = null) : base(document, xml) { }
+
+ #region Overrides of AbstractField
+
+ public override AbstractField Build()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ sb.Append(" INDEX ");
+ AppendNonEmpty(sb, "b", Bookmark);
+ if (Columns > 0)
+ AppendNonEmpty(sb, "c", Columns.ToString());
+ AppendNonEmpty(sb, "d", SequencePageSeparator);
+ AppendNonEmpty(sb, "e", EntryPageSeparator);
+ AppendNonEmpty(sb, "f", IndexName);
+ AppendNonEmpty(sb, "g", PageRangeSeparator);
+ AppendNonEmpty(sb, "h", LetterHeading);
+ AppendNonEmpty(sb, "k", XrefSeparator);
+ AppendNonEmpty(sb, "l", PagePageSeparator);
+ AppendNonEmpty(sb, "p", LetterRange);
+ if (RunSubentries) sb.Append("\\r ");
+ AppendNonEmpty(sb, "s", SequenceName);
+ if (EnableYomi) sb.Append("\\y ");
+ AppendNonEmpty(sb, "z", LanguageId);
+
+ Xml = Build(sb.ToString(), UpdateFieldPrompt);
+ return this;
+ }
+
+ private void AppendNonEmpty(StringBuilder sb, string field, string fieldArg)
+ {
+ if (string.IsNullOrEmpty(fieldArg)) return;
+ // we always leave a trailing space, needed to separate from the field end mark
+ sb.Append($"\\{field} \"{fieldArg}\" ");
+ }
+
+ #endregion
+ }
+}
diff --git a/Xceed.Document.NET/Src/NoteRefField.cs b/Xceed.Document.NET/Src/NoteRefField.cs
new file mode 100644
index 0000000..cd7bf0d
--- /dev/null
+++ b/Xceed.Document.NET/Src/NoteRefField.cs
@@ -0,0 +1,36 @@
+using System.Text;
+using System.Xml.Linq;
+
+namespace Xceed.Document.NET.Src
+{
+ public class NoteRefField : AbstractField
+ {
+ public string MarkName { get; set; }
+ public string ReferenceText { get; set; }
+ public bool SameFormatting { get; set; }
+ public bool InsertHyperlink { get; set; }
+ public bool InsertRelativePosition { get; set; }
+
+
+ #region Overrides of AbstractField
+
+ public override AbstractField Build()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append(" NOTEREF ").Append(MarkName).Append(' ');
+ if (SameFormatting)
+ sb.Append("\\f ");
+ if (InsertRelativePosition)
+ sb.Append("\\p ");
+ if (InsertHyperlink)
+ sb.Append("\\h ");
+
+ Xml = Build(sb.ToString(), ReferenceText);
+ return this;
+ }
+
+ #endregion
+
+ public NoteRefField(Document document, XElement xml = null) : base(document, xml) { }
+ }
+}
diff --git a/Xceed.Document.NET/Src/Paragraph.cs b/Xceed.Document.NET/Src/Paragraph.cs
index 5f80950..10065b3 100644
--- a/Xceed.Document.NET/Src/Paragraph.cs
+++ b/Xceed.Document.NET/Src/Paragraph.cs
@@ -1304,7 +1304,52 @@ public override void InsertPageBreakAfterSelf()
base.InsertPageBreakAfterSelf();
}
- [Obsolete( "Instead use: InsertHyperlink(Hyperlink h, int index)" )]
+
+ public Paragraph InsertField(AbstractField f, int index = 0)
+ {
+ if (index == 0)
+ {
+ // Add this field as the first element.
+ Xml.AddFirst(f.Xml);
+ }
+ else
+ {
+ // Get the first run effected by this Insert
+ Run run = GetFirstRunEffectedByEdit(index);
+
+ if (run == null)
+ {
+ // Add this field as the last element.
+ Xml.Add(f.Xml);
+ }
+ else
+ {
+ // Split this run at the point you want to insert
+ XElement[] splitRun = Run.SplitRun(run, index);
+
+ // Replace the original run.
+ run.Xml.ReplaceWith
+ (
+ splitRun[0],
+ f.Xml,
+ splitRun[1]
+ );
+ }
+ }
+
+ this._runs = Xml.Elements().Last().Elements(XName.Get("r", Document.w.NamespaceName)).ToList();
+ return this;
+ }
+
+ public Paragraph AppendField(AbstractField f)
+ {
+ Xml.Add(f.Xml);
+ this._runs = Xml.Elements().Last().Elements(XName.Get("r", Document.w.NamespaceName)).ToList();
+ return this;
+ }
+
+
+ [Obsolete( "Instead use: InsertHyperlink(Hyperlink h, int index)" )]
public Paragraph InsertHyperlink( int index, Hyperlink h )
{
return InsertHyperlink( h, index );
@@ -2199,6 +2244,9 @@ public Paragraph Append( string text, Formatting format )
if( format.UnderlineStyle.HasValue )
UnderlineStyle( format.UnderlineStyle.Value );
+ if (!string.IsNullOrEmpty(format.StyleId))
+ Style(format.StyleId);
+
return this;
}
@@ -3349,44 +3397,51 @@ public Paragraph PercentageScale( float percentageScale )
return this;
}
-
- ///
- /// Append a field of type document property, this field will display the custom property cp, at the end of this paragraph.
- ///
- /// The custom property to display.
- /// The formatting to use for this text.
- ///
- ///
- /// Create, add and display a custom property in a document.
- ///
- /// // Load a document.
- ///using (var document = DocX.Create("CustomProperty_Add.docx"))
- ///{
- /// // Add a few Custom Properties to this document.
- /// document.AddCustomProperty(new CustomProperty("fname", "cathal"));
- /// document.AddCustomProperty(new CustomProperty("age", 24));
- /// document.AddCustomProperty(new CustomProperty("male", true));
- /// document.AddCustomProperty(new CustomProperty("newyear2012", new DateTime(2012, 1, 1)));
- /// document.AddCustomProperty(new CustomProperty("fav_num", 3.141592));
- ///
- /// // Insert a new Paragraph and append a load of DocProperties.
- /// Paragraph p = document.InsertParagraph("fname: ")
- /// .AppendDocProperty(document.CustomProperties["fname"])
- /// .Append(", age: ")
- /// .AppendDocProperty(document.CustomProperties["age"])
- /// .Append(", male: ")
- /// .AppendDocProperty(document.CustomProperties["male"])
- /// .Append(", newyear2012: ")
- /// .AppendDocProperty(document.CustomProperties["newyear2012"])
- /// .Append(", fav_num: ")
- /// .AppendDocProperty(document.CustomProperties["fav_num"]);
- ///
- /// // Save the changes to the document.
- /// document.Save();
- ///}
- ///
- ///
- public Paragraph AppendDocProperty( CustomProperty cp, bool trackChanges = false, Formatting f = null )
+ public Paragraph Style(string stylid)
+ {
+
+ ApplyTextFormattingProperty(XName.Get("rStyle", Document.w.NamespaceName), string.Empty, new XAttribute(XName.Get("val", Document.w.NamespaceName), stylid));
+
+ return this;
+ }
+
+ ///
+ /// Append a field of type document property, this field will display the custom property cp, at the end of this paragraph.
+ ///
+ /// The custom property to display.
+ /// The formatting to use for this text.
+ ///
+ ///
+ /// Create, add and display a custom property in a document.
+ ///
+ /// // Load a document.
+ ///using (var document = DocX.Create("CustomProperty_Add.docx"))
+ ///{
+ /// // Add a few Custom Properties to this document.
+ /// document.AddCustomProperty(new CustomProperty("fname", "cathal"));
+ /// document.AddCustomProperty(new CustomProperty("age", 24));
+ /// document.AddCustomProperty(new CustomProperty("male", true));
+ /// document.AddCustomProperty(new CustomProperty("newyear2012", new DateTime(2012, 1, 1)));
+ /// document.AddCustomProperty(new CustomProperty("fav_num", 3.141592));
+ ///
+ /// // Insert a new Paragraph and append a load of DocProperties.
+ /// Paragraph p = document.InsertParagraph("fname: ")
+ /// .AppendDocProperty(document.CustomProperties["fname"])
+ /// .Append(", age: ")
+ /// .AppendDocProperty(document.CustomProperties["age"])
+ /// .Append(", male: ")
+ /// .AppendDocProperty(document.CustomProperties["male"])
+ /// .Append(", newyear2012: ")
+ /// .AppendDocProperty(document.CustomProperties["newyear2012"])
+ /// .Append(", fav_num: ")
+ /// .AppendDocProperty(document.CustomProperties["fav_num"]);
+ ///
+ /// // Save the changes to the document.
+ /// document.Save();
+ ///}
+ ///
+ ///
+ public Paragraph AppendDocProperty( CustomProperty cp, bool trackChanges = false, Formatting f = null )
{
this.InsertDocProperty( cp, trackChanges, f );
return this;
@@ -4306,6 +4361,8 @@ public Paragraph AppendBookmark( string bookmarkName )
return this;
}
+ public static int NextBookmarkId => bookmarkIdCounter++;
+
public void ClearBookmarks()
{
var bookmarkStarts = this.Xml.Descendants( XName.Get( "bookmarkStart", Document.w.NamespaceName ) );
diff --git a/Xceed.Document.NET/Xceed.Document.NET.csproj b/Xceed.Document.NET/Xceed.Document.NET.csproj
index 117df14..3f71e13 100644
--- a/Xceed.Document.NET/Xceed.Document.NET.csproj
+++ b/Xceed.Document.NET/Xceed.Document.NET.csproj
@@ -89,6 +89,7 @@
+
@@ -100,19 +101,23 @@
+
+
+
+
@@ -165,4 +170,4 @@
-->
-
+
\ No newline at end of file
diff --git a/Xceed.Words.NET.Examples/Program.cs b/Xceed.Words.NET.Examples/Program.cs
index 5ef46b7..f3e39b3 100644
--- a/Xceed.Words.NET.Examples/Program.cs
+++ b/Xceed.Words.NET.Examples/Program.cs
@@ -12,7 +12,6 @@
using System;
using System.Collections.Generic;
using System.Reflection;
-using System.Threading;
namespace Xceed.Words.NET.Examples
{
@@ -106,6 +105,15 @@ private static void Main( string[] args )
TableOfContentSample.InsertTableOfContentWithReference();
TableOfContentSample.UpdateTableOfContent();
+ // indexing
+ IndexSample.SimpleIndex();
+ IndexSample.MultiIndex();
+
+ //Footnotes / Endnotes
+ FootnoteSample.BookmarkedFootnote();
+ FootnoteSample.SimpleFootnote();
+ EndnoteSample.SimpleEndnote();
+
//Lines
LineSample.InsertHorizontalLine();
diff --git a/Xceed.Words.NET.Examples/Samples/Bookmark/Output/InsertBookmarks.docx b/Xceed.Words.NET.Examples/Samples/Bookmark/Output/InsertBookmarks.docx
index a659dff..008f2a2 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Bookmark/Output/InsertBookmarks.docx and b/Xceed.Words.NET.Examples/Samples/Bookmark/Output/InsertBookmarks.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Bookmark/Output/ReplaceBookmarkText.docx b/Xceed.Words.NET.Examples/Samples/Bookmark/Output/ReplaceBookmarkText.docx
index 48413f7..883ee27 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Bookmark/Output/ReplaceBookmarkText.docx and b/Xceed.Words.NET.Examples/Samples/Bookmark/Output/ReplaceBookmarkText.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Chart/Output/3DChart.docx b/Xceed.Words.NET.Examples/Samples/Chart/Output/3DChart.docx
index 07e9fcf..548440b 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Chart/Output/3DChart.docx and b/Xceed.Words.NET.Examples/Samples/Chart/Output/3DChart.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Chart/Output/BarChart.docx b/Xceed.Words.NET.Examples/Samples/Chart/Output/BarChart.docx
index b708b90..de5d61b 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Chart/Output/BarChart.docx and b/Xceed.Words.NET.Examples/Samples/Chart/Output/BarChart.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Chart/Output/LineChart.docx b/Xceed.Words.NET.Examples/Samples/Chart/Output/LineChart.docx
index 1d3c563..acaee75 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Chart/Output/LineChart.docx and b/Xceed.Words.NET.Examples/Samples/Chart/Output/LineChart.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Chart/Output/PieChart.docx b/Xceed.Words.NET.Examples/Samples/Chart/Output/PieChart.docx
index 4a133dc..73446d2 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Chart/Output/PieChart.docx and b/Xceed.Words.NET.Examples/Samples/Chart/Output/PieChart.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Document/Output/AddCustomProperties.docx b/Xceed.Words.NET.Examples/Samples/Document/Output/AddCustomProperties.docx
index a207ccf..d4dc388 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Document/Output/AddCustomProperties.docx and b/Xceed.Words.NET.Examples/Samples/Document/Output/AddCustomProperties.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Document/Output/AppendDocument.docx b/Xceed.Words.NET.Examples/Samples/Document/Output/AppendDocument.docx
index edfc90b..6ce10e1 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Document/Output/AppendDocument.docx and b/Xceed.Words.NET.Examples/Samples/Document/Output/AppendDocument.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Document/Output/ApplyTemplate.docx b/Xceed.Words.NET.Examples/Samples/Document/Output/ApplyTemplate.docx
index d9ef1d4..3ed9efe 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Document/Output/ApplyTemplate.docx and b/Xceed.Words.NET.Examples/Samples/Document/Output/ApplyTemplate.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Document/Output/LoadDocumentWithFilename.docx b/Xceed.Words.NET.Examples/Samples/Document/Output/LoadDocumentWithFilename.docx
index 2ba7019..5d829ef 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Document/Output/LoadDocumentWithFilename.docx and b/Xceed.Words.NET.Examples/Samples/Document/Output/LoadDocumentWithFilename.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Document/Output/LoadDocumentWithStream.docx b/Xceed.Words.NET.Examples/Samples/Document/Output/LoadDocumentWithStream.docx
index dca7074..c7acb40 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Document/Output/LoadDocumentWithStream.docx and b/Xceed.Words.NET.Examples/Samples/Document/Output/LoadDocumentWithStream.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Document/Output/LoadDocumentWithUrl.docx b/Xceed.Words.NET.Examples/Samples/Document/Output/LoadDocumentWithUrl.docx
index 290b0e5..9c502f6 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Document/Output/LoadDocumentWithUrl.docx and b/Xceed.Words.NET.Examples/Samples/Document/Output/LoadDocumentWithUrl.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Document/Output/ReplacedText.docx b/Xceed.Words.NET.Examples/Samples/Document/Output/ReplacedText.docx
index 7242891..44e3acd 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Document/Output/ReplacedText.docx and b/Xceed.Words.NET.Examples/Samples/Document/Output/ReplacedText.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Document/Output/ReplacedTextWithObjects.docx b/Xceed.Words.NET.Examples/Samples/Document/Output/ReplacedTextWithObjects.docx
index 39bd813..1ab10f2 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Document/Output/ReplacedTextWithObjects.docx and b/Xceed.Words.NET.Examples/Samples/Document/Output/ReplacedTextWithObjects.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Equation/Output/EquationSample.docx b/Xceed.Words.NET.Examples/Samples/Equation/Output/EquationSample.docx
index 8ec45f7..7062f89 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Equation/Output/EquationSample.docx and b/Xceed.Words.NET.Examples/Samples/Equation/Output/EquationSample.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/EndnoteSample.cs b/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/EndnoteSample.cs
new file mode 100644
index 0000000..c63a17e
--- /dev/null
+++ b/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/EndnoteSample.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using Xceed.Document.NET.Src;
+using Xceed.Words.NET.Examples;
+
+namespace Xceed.Words.NET.Examples
+{
+ public class EndnoteSample
+ {
+ #region Private Members
+
+ private const string FootnoteSampleOutputDirectory = Program.SampleDirectory + @"FootnotesEndnotes\Output\";
+
+ #endregion
+
+ #region Constructors
+
+ static EndnoteSample()
+ {
+ if (!Directory.Exists(FootnoteSampleOutputDirectory))
+ {
+ Directory.CreateDirectory(FootnoteSampleOutputDirectory);
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ public static void SimpleEndnote()
+ {
+ Console.WriteLine("\tSimpleEndnote()");
+ string[] noteBrackets = new[] { "[", "]" };
+ using (var document = DocX.Create(FootnoteSampleOutputDirectory + @"SimpleEndnote.docx"))
+ {
+ // Insert a Paragraph into this document.
+ var p = document.InsertParagraph();
+
+ // Append some text and add formatting.
+ p.Append("This is a simple paragraph with an endnote.");
+ // Append a footnote
+ Endnote fn = new Endnote(document, "Make note of this source information.");
+ fn.Apply(p);
+
+ // new page, new para, append an endnote in the middle of text
+ // with the optional []s around the number
+ document.InsertSectionPageBreak();
+ p = document.InsertParagraph();
+ p.Append("This is another example, with brackets to set off the note number,");
+ fn = new Endnote(document, "This source information is also noteworthy, and the note is made extra long in order to illustrate the default style of hanging indent; a human can easily edit the style in the output document (that's WHY we use styles!).", noteBrackets);
+ fn.Apply(p);
+ p.Append(" and so on to the end of the sentence.");
+
+ // Save this document to disk.
+ document.Save();
+ Console.WriteLine("\tCreated: SimpleEndnote.docx\n");
+ }
+
+ }
+ #endregion
+ }
+}
diff --git a/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/FootnoteSample.cs b/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/FootnoteSample.cs
new file mode 100644
index 0000000..0306150
--- /dev/null
+++ b/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/FootnoteSample.cs
@@ -0,0 +1,118 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.IO;
+using Xceed.Document.NET;
+using Xceed.Document.NET.Src;
+
+namespace Xceed.Words.NET.Examples
+{
+ public class FootnoteSample
+ {
+ #region Private Members
+
+ private const string FootnoteSampleOutputDirectory = Program.SampleDirectory + @"FootnotesEndnotes\Output\";
+
+ #endregion
+
+ #region Constructors
+
+ static FootnoteSample()
+ {
+ if (!Directory.Exists(FootnoteSample.FootnoteSampleOutputDirectory))
+ {
+ Directory.CreateDirectory(FootnoteSample.FootnoteSampleOutputDirectory);
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ public static void SimpleFootnote()
+ {
+ Console.WriteLine("\tSimpleFootnote()");
+ string[] noteBrackets = new[] {"[", "]"};
+ using (var document = DocX.Create(FootnoteSampleOutputDirectory + @"SimpleFootnote.docx"))
+ {
+ // Insert a Paragraph into this document.
+ var p = document.InsertParagraph();
+
+ // Append some text and add formatting.
+ p.Append("This is a simple paragraph with a footnote.");
+ // Append a footnote
+ Footnote fn = new Footnote(document, "Make note of this source information.");
+ fn.Apply(p);
+
+ // new para, append a footnote in the middle of text
+ // with the optional []s around the number
+ p = document.InsertParagraph();
+ p.Append("This is another example, with brackets to set off the note number,");
+ fn = new Footnote(document, "This source information is also noteworthy, and the note is made extra long in order to illustrate the default style of hanging indent; a human can easily edit the style in the output document (that's WHY we use styles!).", noteBrackets);
+ fn.Apply(p);
+ p.Append(" and so on to the end of the sentence.");
+
+ // and another on the next page
+ document.InsertSectionPageBreak();
+ p = document.InsertParagraph();
+ p.Append("This is another example, to show that footnotes appear,");
+ fn = new Footnote(document, "This source is the best authority.");
+ fn.Apply(p);
+ p.Append(" on the same page not at the end.");
+
+ // Save this document to disk.
+ document.Save();
+ Console.WriteLine("\tCreated: SimpleFootnote.docx\n");
+ }
+
+ }
+ public static void BookmarkedFootnote()
+ {
+ Console.WriteLine("\tBookmarkedFootnote()");
+ //Footnote.BookmarkReferencePattern = "See note {0}.";
+ string[] noteBrackets = new[] { "[", "]" };
+ using (var document = DocX.Create(FootnoteSampleOutputDirectory + @"BookmarkedFootnote.docx"))
+ {
+ // Insert a Paragraph into this document.
+ var p = document.InsertParagraph();
+
+ // Append some text and add formatting.
+ p.Append("This is a simple paragraph with a footnote.");
+ // Append a footnote
+ Footnote fnRef = new Footnote(document, "Make note of this source information.");
+ fnRef.Apply(p, true);
+
+ // new para, append a footnote in the middle of text
+ // with the optional []s around the number
+ p = document.InsertParagraph();
+ p.Append("This is another example, with brackets to set off the note number,");
+ Footnote fn = new Footnote(document, "This source information is also noteworthy, and the note is made extra long in order to illustrate the default style of hanging indent; a human can easily edit the style in the output document (that's WHY we use styles!).", noteBrackets);
+ fn.Apply(p);
+ p.Append(" and so on to the end of the sentence.");
+
+ // and another on the next page
+ document.InsertSectionPageBreak();
+ p = document.InsertParagraph();
+ p.Append("This is another example, to show that footnotes appear,");
+ fn = new Footnote(document, "This source is the best authority.");
+ fn.Apply(p);
+ p.Append(" on the same page not at the end.");
+
+ // this shows how to include note reference and hyperlink in a footnote
+ fn = new Footnote(document)
+ .AppendText("See note ")
+ .AppendNoteRef(fnRef)
+ .AppendText(". See also, ")
+ .AppendHyperlink("http://www.google.com")
+ .AppendText(".");
+ fn.Apply(p);
+
+ // Save this document to disk.
+ document.Save();
+ Console.WriteLine("\tCreated: BookmarkedFootnote.docx\n");
+ }
+
+ }
+ #endregion
+ }
+}
diff --git a/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/Output/BookmarkedFootnote.docx b/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/Output/BookmarkedFootnote.docx
new file mode 100644
index 0000000..df00e05
Binary files /dev/null and b/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/Output/BookmarkedFootnote.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/Output/SimpleEndnote.docx b/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/Output/SimpleEndnote.docx
new file mode 100644
index 0000000..82f36eb
Binary files /dev/null and b/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/Output/SimpleEndnote.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/Output/SimpleFootnote.docx b/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/Output/SimpleFootnote.docx
new file mode 100644
index 0000000..3bdeed6
Binary files /dev/null and b/Xceed.Words.NET.Examples/Samples/FootnotesEndnotes/Output/SimpleFootnote.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/HeaderFooter/Output/HeadersFooters.docx b/Xceed.Words.NET.Examples/Samples/HeaderFooter/Output/HeadersFooters.docx
index edcdbc4..1181bbe 100644
Binary files a/Xceed.Words.NET.Examples/Samples/HeaderFooter/Output/HeadersFooters.docx and b/Xceed.Words.NET.Examples/Samples/HeaderFooter/Output/HeadersFooters.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Hyperlink/Output/Hyperlinks.docx b/Xceed.Words.NET.Examples/Samples/Hyperlink/Output/Hyperlinks.docx
index 00dbe17..8092dcd 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Hyperlink/Output/Hyperlinks.docx and b/Xceed.Words.NET.Examples/Samples/Hyperlink/Output/Hyperlinks.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Image/Output/AddPicture.docx b/Xceed.Words.NET.Examples/Samples/Image/Output/AddPicture.docx
index 26716f9..42da51a 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Image/Output/AddPicture.docx and b/Xceed.Words.NET.Examples/Samples/Image/Output/AddPicture.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Image/Output/CopyPicture.docx b/Xceed.Words.NET.Examples/Samples/Image/Output/CopyPicture.docx
index 430252b..12d8225 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Image/Output/CopyPicture.docx and b/Xceed.Words.NET.Examples/Samples/Image/Output/CopyPicture.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Image/Output/ModifyImage.docx b/Xceed.Words.NET.Examples/Samples/Image/Output/ModifyImage.docx
index 235d10c..4fe1ea0 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Image/Output/ModifyImage.docx and b/Xceed.Words.NET.Examples/Samples/Image/Output/ModifyImage.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Index/IndexSample.cs b/Xceed.Words.NET.Examples/Samples/Index/IndexSample.cs
new file mode 100644
index 0000000..4df6205
--- /dev/null
+++ b/Xceed.Words.NET.Examples/Samples/Index/IndexSample.cs
@@ -0,0 +1,118 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using Xceed.Document.NET;
+using Xceed.Document.NET.Src;
+using Xceed.Words.NET.Examples;
+
+namespace Xceed.Words.NET.Examples
+{
+ public class IndexSample
+ {
+ #region Private Members
+
+ private const string IndexSampleOutputDirectory = Program.SampleDirectory + @"Index\Output\";
+
+ #endregion
+
+ #region Constructors
+
+ static IndexSample()
+ {
+ if (!Directory.Exists(IndexSampleOutputDirectory))
+ {
+ Directory.CreateDirectory(IndexSampleOutputDirectory);
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+ public static void SimpleIndex()
+ {
+ Console.WriteLine("\tSimpleIndex()");
+
+ using (var document = DocX.Create(IndexSampleOutputDirectory + @"SimpleIndex.docx"))
+ {
+ // Insert a Paragraph into this document.
+ var p = document.InsertParagraph();
+
+ // Append some text and index entries.
+ p.Append("This is a simple paragraph about John Smith");
+ p.AppendField(new IndexEntry(document) {IndexValue = "Smith:John"}.Build());
+ p.Append(" and his buddy Abe Jones");
+ p.AppendField(new IndexEntry(document) { IndexValue = "Jones:Abraham" }.Build());
+
+ document.InsertSectionPageBreak();
+ p = document.InsertParagraph("We have a lot more to say about that Jones!");
+ p.AppendField(new IndexEntry(document) { IndexValue = "Jones:Abraham" }.Build());
+ p.Append(" He was quite a character.");
+
+ document.InsertSectionPageBreak();
+ p = document.InsertParagraph();
+ p = document.InsertParagraph("Index of Names", false, new Formatting(){Bold = true});
+ p = document.InsertParagraph();
+ p.AppendField(new IndexField(document) {Columns = 2}.Build());
+
+ // Save this document to disk.
+ document.Save();
+ Console.WriteLine("\tCreated: SimpleIndex.docx");
+ Console.WriteLine("\t\tNB to show index, open doc and hit ctrl-a then F9\n");
+ }
+
+ }
+ public static void MultiIndex()
+ {
+ Console.WriteLine("\tMultiIndex()");
+
+ string nameType = "names";
+ string placeType = "places";
+
+ using (var document = DocX.Create(IndexSampleOutputDirectory + @"MultiIndex.docx"))
+ {
+ // Insert a Paragraph into this document.
+ var p = document.InsertParagraph();
+
+ // Append some text and index entries.
+ p.Append("This is a simple paragraph about John Smith");
+ p.AppendField(new IndexEntry(document) { IndexValue = "Smith:John", IndexName = nameType}.Build());
+ p.Append(" of Jackson Hole, Wyoming");
+ p.AppendField(new IndexEntry(document) { IndexValue = "Wyoming:Teton County:Jackson Hole", IndexName = placeType }.Build());
+ p.Append(" and his buddy Abe Jones");
+ p.AppendField(new IndexEntry(document) { IndexValue = "Jones:Abraham", IndexName = nameType }.Build());
+ p.Append(".");
+
+ document.InsertSectionPageBreak();
+ p = document.InsertParagraph("We have a lot more to say about that Jones!");
+ p.AppendField(new IndexEntry(document) { IndexValue = "Jones:Abraham", IndexName = nameType }.Build());
+ p.Append(" He was quite a character. He came to Wyoming");
+ p.AppendField(new IndexEntry(document) { IndexValue = "Wyoming", IndexName = placeType }.Build());
+ p.Append(" from New London.");
+ p.AppendField(new IndexEntry(document) { IndexValue = "Connecticut:New London County:New London", IndexName = placeType }.Build());
+
+
+ document.InsertSectionPageBreak();
+ p = document.InsertParagraph();
+ p = document.InsertParagraph("Index of Names", false, new Formatting() { Bold = true });
+ p = document.InsertParagraph();
+ p.AppendField(new IndexField(document) { Columns = 2, IndexName=nameType }.Build());
+
+ document.InsertSectionPageBreak();
+ p = document.InsertParagraph();
+ p = document.InsertParagraph("Index of Places", false, new Formatting() { Bold = true });
+ p = document.InsertParagraph();
+ p.AppendField(new IndexField(document) { Columns = 1, IndexName = placeType}.Build());
+
+ // Save this document to disk.
+ document.Save();
+ Console.WriteLine("\tCreated: MultiIndex.docx");
+ Console.WriteLine("\t\tNB to show index, open doc and hit ctrl-a then F9\n");
+ }
+
+ }
+ #endregion
+
+ }
+}
diff --git a/Xceed.Words.NET.Examples/Samples/Index/Output/MultiIndex.docx b/Xceed.Words.NET.Examples/Samples/Index/Output/MultiIndex.docx
new file mode 100644
index 0000000..08931e5
Binary files /dev/null and b/Xceed.Words.NET.Examples/Samples/Index/Output/MultiIndex.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Index/Output/SimpleIndex.docx b/Xceed.Words.NET.Examples/Samples/Index/Output/SimpleIndex.docx
new file mode 100644
index 0000000..08b34f9
Binary files /dev/null and b/Xceed.Words.NET.Examples/Samples/Index/Output/SimpleIndex.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Line/Output/InsertHorizontalLine.docx b/Xceed.Words.NET.Examples/Samples/Line/Output/InsertHorizontalLine.docx
index 5cef03e..17d7150 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Line/Output/InsertHorizontalLine.docx and b/Xceed.Words.NET.Examples/Samples/Line/Output/InsertHorizontalLine.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/List/Output/AddList.docx b/Xceed.Words.NET.Examples/Samples/List/Output/AddList.docx
index e0367cc..ed41d49 100644
Binary files a/Xceed.Words.NET.Examples/Samples/List/Output/AddList.docx and b/Xceed.Words.NET.Examples/Samples/List/Output/AddList.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Margin/Output/Indentation.docx b/Xceed.Words.NET.Examples/Samples/Margin/Output/Indentation.docx
index 2a19efb..dafc2cc 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Margin/Output/Indentation.docx and b/Xceed.Words.NET.Examples/Samples/Margin/Output/Indentation.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Margin/Output/Margins.docx b/Xceed.Words.NET.Examples/Samples/Margin/Output/Margins.docx
index a7f022c..b3c033a 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Margin/Output/Margins.docx and b/Xceed.Words.NET.Examples/Samples/Margin/Output/Margins.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Margin/Output/SetDirection.docx b/Xceed.Words.NET.Examples/Samples/Margin/Output/SetDirection.docx
index 5a78610..5c33297 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Margin/Output/SetDirection.docx and b/Xceed.Words.NET.Examples/Samples/Margin/Output/SetDirection.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/CompanyReport.docx b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/CompanyReport.docx
index 46c5a30..044a148 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/CompanyReport.docx and b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/CompanyReport.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/CreateInvoice.docx b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/CreateInvoice.docx
index 63a7481..7dfb70d 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/CreateInvoice.docx and b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/CreateInvoice.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/CreateRecipe.docx b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/CreateRecipe.docx
index 6728c00..f9340db 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/CreateRecipe.docx and b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/CreateRecipe.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_153581.docx b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_153581.docx
index e983e5e..80cd1cf 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_153581.docx and b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_153581.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_155285.docx b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_155285.docx
index 95446af..d8c33d2 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_155285.docx and b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_155285.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_159632.docx b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_159632.docx
index a458d05..13ac71c 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_159632.docx and b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_159632.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_161002.docx b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_161002.docx
index cc50f43..3e8b3a2 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_161002.docx and b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_161002.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_162558.docx b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_162558.docx
index 713a9ce..8f57715 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_162558.docx and b/Xceed.Words.NET.Examples/Samples/Miscellaneous/Output/MailMerge/Acceptance_162558.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Paragraph/Output/AddObjectsFromOtherDocument.docx b/Xceed.Words.NET.Examples/Samples/Paragraph/Output/AddObjectsFromOtherDocument.docx
index 1b8a84d..8868a29 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Paragraph/Output/AddObjectsFromOtherDocument.docx and b/Xceed.Words.NET.Examples/Samples/Paragraph/Output/AddObjectsFromOtherDocument.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Paragraph/Output/ForceMultiParagraphsOnSinglePage.docx b/Xceed.Words.NET.Examples/Samples/Paragraph/Output/ForceMultiParagraphsOnSinglePage.docx
index 65c56d0..d5102a8 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Paragraph/Output/ForceMultiParagraphsOnSinglePage.docx and b/Xceed.Words.NET.Examples/Samples/Paragraph/Output/ForceMultiParagraphsOnSinglePage.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Paragraph/Output/ForceParagraphOnSinglePage.docx b/Xceed.Words.NET.Examples/Samples/Paragraph/Output/ForceParagraphOnSinglePage.docx
index 84ed170..3846cee 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Paragraph/Output/ForceParagraphOnSinglePage.docx and b/Xceed.Words.NET.Examples/Samples/Paragraph/Output/ForceParagraphOnSinglePage.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Paragraph/Output/Heading.docx b/Xceed.Words.NET.Examples/Samples/Paragraph/Output/Heading.docx
index 65f2768..a1073c8 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Paragraph/Output/Heading.docx and b/Xceed.Words.NET.Examples/Samples/Paragraph/Output/Heading.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Paragraph/Output/SimpleFormattedParagraphs.docx b/Xceed.Words.NET.Examples/Samples/Paragraph/Output/SimpleFormattedParagraphs.docx
index 34e7ee5..dfaf60f 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Paragraph/Output/SimpleFormattedParagraphs.docx and b/Xceed.Words.NET.Examples/Samples/Paragraph/Output/SimpleFormattedParagraphs.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Paragraph/Output/TextActions.docx b/Xceed.Words.NET.Examples/Samples/Paragraph/Output/TextActions.docx
index 2550c00..c42dcdb 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Paragraph/Output/TextActions.docx and b/Xceed.Words.NET.Examples/Samples/Paragraph/Output/TextActions.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Parallel/Output/OutputDoc1.docx b/Xceed.Words.NET.Examples/Samples/Parallel/Output/OutputDoc1.docx
index 4fbe0f5..2dc8155 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Parallel/Output/OutputDoc1.docx and b/Xceed.Words.NET.Examples/Samples/Parallel/Output/OutputDoc1.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Parallel/Output/OutputDoc2.docx b/Xceed.Words.NET.Examples/Samples/Parallel/Output/OutputDoc2.docx
index 4fa2122..01d90f6 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Parallel/Output/OutputDoc2.docx and b/Xceed.Words.NET.Examples/Samples/Parallel/Output/OutputDoc2.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Parallel/Output/OutputDoc3.docx b/Xceed.Words.NET.Examples/Samples/Parallel/Output/OutputDoc3.docx
index f06a8e5..33d5ab8 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Parallel/Output/OutputDoc3.docx and b/Xceed.Words.NET.Examples/Samples/Parallel/Output/OutputDoc3.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Protection/Output/AddPasswordProtection.docx b/Xceed.Words.NET.Examples/Samples/Protection/Output/AddPasswordProtection.docx
index 03a939e..545023d 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Protection/Output/AddPasswordProtection.docx and b/Xceed.Words.NET.Examples/Samples/Protection/Output/AddPasswordProtection.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Protection/Output/AddProtection.docx b/Xceed.Words.NET.Examples/Samples/Protection/Output/AddProtection.docx
index 9604565..739f322 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Protection/Output/AddProtection.docx and b/Xceed.Words.NET.Examples/Samples/Protection/Output/AddProtection.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Section/Output/InsertSections.docx b/Xceed.Words.NET.Examples/Samples/Section/Output/InsertSections.docx
index ca58fdd..ea6af75 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Section/Output/InsertSections.docx and b/Xceed.Words.NET.Examples/Samples/Section/Output/InsertSections.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Section/Output/SetPageOrientations.docx b/Xceed.Words.NET.Examples/Samples/Section/Output/SetPageOrientations.docx
index 53cf5d0..7ef4b00 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Section/Output/SetPageOrientations.docx and b/Xceed.Words.NET.Examples/Samples/Section/Output/SetPageOrientations.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Table/Output/ColumnsWidth.docx b/Xceed.Words.NET.Examples/Samples/Table/Output/ColumnsWidth.docx
index 1b93538..af3b276 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Table/Output/ColumnsWidth.docx and b/Xceed.Words.NET.Examples/Samples/Table/Output/ColumnsWidth.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Table/Output/CreateTableFromTemplate.docx b/Xceed.Words.NET.Examples/Samples/Table/Output/CreateTableFromTemplate.docx
index 75bf9de..0f88fa8 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Table/Output/CreateTableFromTemplate.docx and b/Xceed.Words.NET.Examples/Samples/Table/Output/CreateTableFromTemplate.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Table/Output/InsertRowAndImageTable.docx b/Xceed.Words.NET.Examples/Samples/Table/Output/InsertRowAndImageTable.docx
index bedee15..5ff9f19 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Table/Output/InsertRowAndImageTable.docx and b/Xceed.Words.NET.Examples/Samples/Table/Output/InsertRowAndImageTable.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Table/Output/MergeCells.docx b/Xceed.Words.NET.Examples/Samples/Table/Output/MergeCells.docx
index 0686b70..b950a93 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Table/Output/MergeCells.docx and b/Xceed.Words.NET.Examples/Samples/Table/Output/MergeCells.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/Table/Output/TextDirectionTable.docx b/Xceed.Words.NET.Examples/Samples/Table/Output/TextDirectionTable.docx
index 2218718..e8eca8c 100644
Binary files a/Xceed.Words.NET.Examples/Samples/Table/Output/TextDirectionTable.docx and b/Xceed.Words.NET.Examples/Samples/Table/Output/TextDirectionTable.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/TableOfContent/Output/InsertTableOfContent.docx b/Xceed.Words.NET.Examples/Samples/TableOfContent/Output/InsertTableOfContent.docx
index 53bfd7c..16d26cc 100644
Binary files a/Xceed.Words.NET.Examples/Samples/TableOfContent/Output/InsertTableOfContent.docx and b/Xceed.Words.NET.Examples/Samples/TableOfContent/Output/InsertTableOfContent.docx differ
diff --git a/Xceed.Words.NET.Examples/Samples/TableOfContent/Output/InsertTableOfContentWithReference.docx b/Xceed.Words.NET.Examples/Samples/TableOfContent/Output/InsertTableOfContentWithReference.docx
index 3c0b5d3..5b5128a 100644
Binary files a/Xceed.Words.NET.Examples/Samples/TableOfContent/Output/InsertTableOfContentWithReference.docx and b/Xceed.Words.NET.Examples/Samples/TableOfContent/Output/InsertTableOfContentWithReference.docx differ
diff --git a/Xceed.Words.NET.Examples/Xceed.Words.NET.Examples.csproj b/Xceed.Words.NET.Examples/Xceed.Words.NET.Examples.csproj
index 51b1146..4d741b5 100644
--- a/Xceed.Words.NET.Examples/Xceed.Words.NET.Examples.csproj
+++ b/Xceed.Words.NET.Examples/Xceed.Words.NET.Examples.csproj
@@ -53,9 +53,12 @@
+
+
+
@@ -112,6 +115,7 @@
..\Xceed.Words.NET\bin\Debug\Xceed.Words.NET.dll
+
-
+
\ No newline at end of file