Переглянути джерело

Merge pull request #45 from janbernloehr/master

Fix HelperFunctions.FormatInput doubles new lines (Issue #44)
master
PrzemyslawKlys 9 роки тому
джерело
коміт
cb982ab61d
1 змінених файлів з 15 додано та 0 видалено
  1. 15
    0
      DocX/HelperFunctions.cs

+ 15
- 0
DocX/HelperFunctions.cs Переглянути файл

@@ -549,6 +549,8 @@ namespace Novacode
{
return newRuns; //I dont wanna get an exception if text == null, so just return empy list
}
char lastChar = '\0';
foreach (char c in text)
{
@@ -565,7 +567,18 @@ namespace Novacode
newRuns.Add(new XElement(DocX.w + "r", rPr, tabRun));
break;
case '\r':
if (sb.Length > 0)
{
XElement t = new XElement(DocX.w + "t", sb.ToString());
Novacode.Text.PreserveSpace(t);
newRuns.Add(new XElement(DocX.w + "r", rPr, t));
sb = new StringBuilder();
}
newRuns.Add(new XElement(DocX.w + "r", rPr, breakRun));
break;
case '\n':
if (lastChar == '\r') break;
if (sb.Length > 0)
{
XElement t = new XElement(DocX.w + "t", sb.ToString());
@@ -580,6 +593,8 @@ namespace Novacode
sb.Append(c);
break;
}
lastChar = c;
}
if (sb.Length > 0)

Завантаження…
Відмінити
Зберегти