Skip to content

Commit

Permalink
Merge pull request #1408 from wuzxc1230123/fix/SXSSFWorkbook
Browse files Browse the repository at this point in the history
fix: update \r ASCII/UTF
  • Loading branch information
tonyqus committed Aug 28, 2024
2 parents 282c9e5 + 690af39 commit 93b88c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion ooxml/XSSF/Streaming/SheetDataWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,12 +471,19 @@ protected void OutputQuotedString(string s)
break;
// Special characters
case '\n':
if(counter > last)
{
WriteAsBytes(GetSubArray(chars, last, counter - last));
}
WriteAsBytes("
");
last = counter + 1;
break;
case '\r':
if (counter > last)
{
WriteAsBytes(GetSubArray(chars, last, counter - last));
}
WriteAsBytes("
");
WriteAsBytes("
");
last = counter + 1;
break;
case '\t':
Expand Down
2 changes: 1 addition & 1 deletion testcases/ooxml/XSSF/Streaming/SheetDataWriterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public void IfCellTypeIsStringShouldWriteStringCellXml()
var lines = File.ReadAllLines(_objectToTest.TemporaryFilePath());

Assert.True(lines.Length == 1);
Assert.AreEqual("<c r=\"A1\" t=\"inlineStr\"><is><t xml:space=\"preserve\">\'\'&lt;&gt;&#x9;&#xa;&#xa;&amp;&quot;? test:SLDFKj </t></is></c>", lines[0]);
Assert.AreEqual("<c r=\"A1\" t=\"inlineStr\"><is><t xml:space=\"preserve\">\'\'&lt;&gt;&#x9;&#xa;&#xd;&amp;&quot;? test:SLDFKj </t></is></c>", lines[0]);

}

Expand Down

0 comments on commit 93b88c3

Please sign in to comment.