瀏覽代碼

Fixed a bug in InsertParagraph that introduced a new empty paragraph at the very beginning of a document when inserting at 0.

master
fitdev@hotmail.com 10 年之前
父節點
當前提交
86fb85725d
共有 1 個檔案被更改,包括 15 行新增 和 8 行删除
  1. 15
    8
      DocX/Container.cs

+ 15
- 8
DocX/Container.cs 查看文件

if (firstPar != null) if (firstPar != null)
{ {
XElement[] splitParagraph = HelperFunctions.SplitParagraph(firstPar, index - firstPar.startIndex);
firstPar.Xml.ReplaceWith
(
splitParagraph[0],
newParagraph.Xml,
splitParagraph[1]
);
var splitindex = index - firstPar.startIndex;
if (splitindex <= 0)
{
firstPar.Xml.ReplaceWith(newParagraph.Xml, firstPar.Xml);
}
else {
XElement[] splitParagraph = HelperFunctions.SplitParagraph(firstPar, splitindex);
firstPar.Xml.ReplaceWith
(
splitParagraph[0],
newParagraph.Xml,
splitParagraph[1]
);
}
} }
else else

Loading…
取消
儲存