Преглед на файлове

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 преди 15 години
родител
ревизия
b2d74023ce
променени са 3 файла, в които са добавени 9 реда и са изтрити 4 реда
  1. Двоични данни
      DocX/Help/Changes in this version 1.0.0.10.docx
  2. 7
    2
      DocX/Paragraph.cs
  3. 2
    2
      DocX/Properties/AssemblyInfo.cs

Двоични данни
DocX/Help/Changes in this version 1.0.0.10.docx Целия файл


+ 7
- 2
DocX/Paragraph.cs Целия файл

@@ -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 Целия файл

@@ -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")]

Loading…
Отказ
Запис