Просмотр исходного кода

Update Container.cs

The paragraph startindex and endindex are corrupted in Document.paragraphs[].
The result was a wrong insertion of paragraphs and tables. (at wrong locations)
The function GetParagraphs had the bug. the variable index in that function should be updated after creation of the paragraph not before

The function public virtual List<int> FindAll(string str, RegexOptions options) was only resulting one item in the list. instead of a list of find idexes 
If there was only find one no big problem but if it finds more the return index was wrong also .
I think  it is a  typo error, instead of  indexes[0]  it should be indexes[i].
master
Twotsman 9 лет назад
Родитель
Сommit
49c0fab471
1 измененных файлов: 3 добавлений и 3 удалений
  1. 3
    3
      DocX/Container.cs

+ 3
- 3
DocX/Container.cs Просмотреть файл

List<Paragraph> paragraphs = new List<Paragraph>(); List<Paragraph> paragraphs = new List<Paragraph>();
foreach (XElement e in Xml.Descendants(XName.Get("p", DocX.w.NamespaceName))) foreach (XElement e in Xml.Descendants(XName.Get("p", DocX.w.NamespaceName)))
{ {
index += HelperFunctions.GetText(e).Length;
Paragraph paragraph = new Paragraph(Document, e, index); Paragraph paragraph = new Paragraph(Document, e, index);
paragraphs.Add(paragraph); paragraphs.Add(paragraph);
index += HelperFunctions.GetText(e).Length;
} }
// GetParagraphsRecursive(Xml, ref index, ref paragraphs, deepSearch); // GetParagraphsRecursive(Xml, ref index, ref paragraphs, deepSearch);
List<int> indexes = p.FindAll(str, options); List<int> indexes = p.FindAll(str, options);
for (int i = 0; i < indexes.Count(); i++) for (int i = 0; i < indexes.Count(); i++)
indexes[0] += p.startIndex;
indexes[i] += p.startIndex;
list.AddRange(indexes); list.AddRange(indexes);
} }
return list; return list;
} }
} }
}
}

Загрузка…
Отмена
Сохранить