Skip to content

Commit d53002e

Browse files
committed
Fixed newline issues with the RTF builder
1 parent 5fe462f commit d53002e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/SmartFormat.Demo/ThirdParty/RTFLib/RTFBuilder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ protected override void AppendInternal(string value)
7171
using (new RTFFormatWrap(this))
7272
{
7373
value = this.CheckChar(value);
74-
if (value.IndexOf(Environment.NewLine) >= 0)
74+
if (value.Contains("\n"))
7575
{
76-
string[] lines = value.Split(new[] {Environment.NewLine}, StringSplitOptions.None);
77-
foreach (string line in lines)
76+
string[] lines = value.Split(new[] {"\r\n","\n"}, StringSplitOptions.None);
77+
for (int i = 0; i < lines.Length; i++)
7878
{
79-
this._sb.Append(line);
80-
this._sb.Append("\\line ");
79+
if (i > 0) this._sb.Append("\\line ");
80+
this._sb.Append(lines[i]);
8181
}
8282
}
8383
else

0 commit comments

Comments
 (0)