소스 검색

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. BIN
      DocX/Help/Changes in this version 1.0.0.10.docx
  2. 7
    2
      DocX/Paragraph.cs
  3. 2
    2
      DocX/Properties/AssemblyInfo.cs

BIN
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…
취소
저장