Procházet zdrojové kódy

After it is executed, RemoveText() deletes elements that have zero text length. This was removing elements which contained no text but still contained a drawing element such as a picture.

This fix checks that an element contains no drawing element and that its text length is zero before removing the element.
master
coffeycathal_cp před 15 roky
rodič
revize
b2d74023ce

binární
DocX/Help/Changes in this version 1.0.0.10.docx Zobrazit soubor


+ 7
- 2
DocX/Paragraph.cs Zobrazit soubor

@@ -2910,8 +2910,13 @@ namespace Novacode
// If after this remove the parent element is empty, remove it.
if (GetElementTextLength(parentElement) == 0)
{
if (parentElement.Parent != null && parentElement.Parent.Name.LocalName != "tc")
parentElement.Remove();
if (parentElement.Parent != null && parentElement.Parent.Name.LocalName != "tc")
{
// Need to make sure there is no drawing element within the parent element.
// Picture elements contain no text length but they are still content.
if (parentElement.Descendants(XName.Get("drawing", DocX.w.NamespaceName)).Count() == 0)
parentElement.Remove();
}
}
}
while (processed < count);

+ 2
- 2
DocX/Properties/AssemblyInfo.cs Zobrazit soubor

@@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.10")]
[assembly: AssemblyFileVersion("1.0.0.10")]
[assembly: AssemblyVersion("1.0.0.11")]
[assembly: AssemblyFileVersion("1.0.0.11")]

Načítá se…
Zrušit
Uložit