Quellcode durchsuchen

This patch adds the ability to access the text of Endnotes and Footnotes defined within a document, otherwise hidden behind an internal XDocument field.

Reason: I was attempting to replicate the functionality of the Interop word-count facility: Document.ComputeStatistics(WdStatistic.wdStatisticWords) which takes IncludeFootnotesAndEndnotes as a boolean parameter. The DocX.Text property does not include endnotes or footnotes (which is fine), but I needed the extra properties to be able to access them when IncludeFootnotesAndEndnotes is true.

Patch provided by Tweet
master
MadBoy_cp vor 11 Jahren
Ursprung
Commit
4ec4d334c2
1 geänderte Dateien mit 29 neuen und 0 gelöschten Zeilen
  1. 29
    0
      DocX/DocX.cs

+ 29
- 0
DocX/DocX.cs Datei anzeigen

@@ -882,6 +882,35 @@ namespace Novacode
return HelperFunctions.GetText(Xml);
}
}
/// <summary>
/// Get the text of each footnote from this document
/// </summary>
public IEnumerable<string> FootnotesText
{
get
{
foreach (XElement footnote in footnotes.Root.Elements(w + "footnote"))
{
yield return HelperFunctions.GetText(footnote);
}
}
}
/// <summary>
/// Get the text of each endnote from this document
/// </summary>
public IEnumerable<string> EndnotesText
{
get
{
foreach (XElement endnote in endnotes.Root.Elements(w + "endnote"))
{
yield return HelperFunctions.GetText(endnote);
}
}
}
internal string GetCollectiveText(List<PackagePart> list)
{

Laden…
Abbrechen
Speichern