Sfoglia il codice sorgente

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 anni fa
parent
commit
86fb85725d
1 ha cambiato i file con 15 aggiunte e 8 eliminazioni
  1. 15
    8
      DocX/Container.cs

+ 15
- 8
DocX/Container.cs Vedi File

@@ -669,14 +669,21 @@ namespace Novacode
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

Loading…
Annulla
Salva