Parcourir la source

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 il y a 15 ans
Parent
révision
b2d74023ce

BIN
DocX/Help/Changes in this version 1.0.0.10.docx Voir le fichier


+ 7
- 2
DocX/Paragraph.cs Voir le fichier

// If after this remove the parent element is empty, remove it. // If after this remove the parent element is empty, remove it.
if (GetElementTextLength(parentElement) == 0) 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); while (processed < count);

+ 2
- 2
DocX/Properties/AssemblyInfo.cs Voir le fichier

// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [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")]

Chargement…
Annuler
Enregistrer