Przeglądaj źródła

You can now apply formatting to empty Paragraphs. A very interesting use case was noted by a post of stackoverflow.com

http://stackoverflow.com/posts/9636913

This post required a hidden paragraph.
master
coffeycathal_cp 14 lat temu
rodzic
commit
80b48d5434
1 zmienionych plików z 23 dodań i 1 usunięć
  1. 23
    1
      DocX/Paragraph.cs

+ 23
- 1
DocX/Paragraph.cs Wyświetl plik

@@ -2375,9 +2375,31 @@ namespace Novacode
internal void ApplyTextFormattingProperty(XName textFormatPropName, string value, object content)
{
XElement rPr = null;
if (runs.Count == 0)
{
XElement pPr = Xml.Element(XName.Get("pPr", DocX.w.NamespaceName));
if (pPr == null)
{
Xml.AddFirst(new XElement(XName.Get("pPr", DocX.w.NamespaceName)));
pPr = Xml.Element(XName.Get("pPr", DocX.w.NamespaceName));
}
rPr = pPr.Element(XName.Get("rPr", DocX.w.NamespaceName));
if (rPr == null)
{
pPr.AddFirst(new XElement(XName.Get("rPr", DocX.w.NamespaceName)));
rPr = pPr.Element(XName.Get("rPr", DocX.w.NamespaceName));
}
rPr.SetElementValue(textFormatPropName, value);
return;
}
foreach (XElement run in runs)
{
XElement rPr = run.Element(XName.Get("rPr", DocX.w.NamespaceName));
rPr = run.Element(XName.Get("rPr", DocX.w.NamespaceName));
if (rPr == null)
{
run.AddFirst(new XElement(XName.Get("rPr", DocX.w.NamespaceName)));

Ładowanie…
Anuluj
Zapisz