Skip to content

Commit

Permalink
Fix bug in phonetic skip logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkPflug committed Sep 15, 2023
1 parent b4f05e7 commit eae44e7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions source/Sylvan.Data.Excel.Tests/CustomTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,6 @@ public void Phonetic()
r.Read();
Assert.Equal("NAME", r.GetString(0));
Assert.Equal("A", r.GetString(1));
Assert.Equal("C,D", r.GetString(2));
}
}
3 changes: 3 additions & 0 deletions source/Sylvan.Data.Excel.Tests/TestData/Phonetic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<c t="s">
<v>1</v>
</c>
<c t="s">
<v>2</v>
</c>
</row>
</sheetData>
</worksheet>
1 change: 1 addition & 0 deletions source/Sylvan.Data.Excel.Tests/TestData/PhoneticSST.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
</rPh>
<phoneticPr fontId="1"/>
</si>
<si><t>C,D</t><rPh sb="0" eb="1"><t>E</t></rPh><rPh sb="2" eb="3"><t>F</t></rPh><phoneticPr fontId="1"/></si>
</sst>
2 changes: 1 addition & 1 deletion source/Sylvan.Data.Excel/Sylvan.Data.Excel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<VersionPrefix>0.4.17</VersionPrefix>
<VersionSuffix>b0002</VersionSuffix>
<VersionSuffix>b0003</VersionSuffix>
<Description>A cross-platform .NET library for reading Excel data files.</Description>
<PackageTags>excel;xls;xlsx;xlsb;datareader</PackageTags>
<Nullable>enable</Nullable>
Expand Down
4 changes: 4 additions & 0 deletions source/Sylvan.Data.Excel/Xlsx/XlsxWorkbookReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -858,9 +858,13 @@ string ReadString(XmlReader reader)
int c = 0;
while (reader.Read() && reader.Depth > depth)
{
start:
if (reader.NodeType == XmlNodeType.Element && reader.LocalName == "rPh")
{
SkipSubtree(reader);
// after skipping the subtree, the reader will already be positioned on the next element
// so we need to avoid calling Read again.
goto start;
}
else
if (reader.NodeType == XmlNodeType.Element && reader.LocalName == "t")
Expand Down

0 comments on commit eae44e7

Please sign in to comment.