Skip to content

Commit

Permalink
Merge pull request #359 from ExcelDataReader/develop
Browse files Browse the repository at this point in the history
3.4.2
  • Loading branch information
andersnm committed Oct 14, 2018
2 parents de60db2 + ac357cc commit 6793a9c
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ExcelDataReader.DataSet/ExcelDataReader.DataSet.csproj
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>ExcelDataReader extension for reading Microsoft Excel files into System.Data.DataSet.</Description>
<AssemblyTitle>ExcelDataReader.DataSet</AssemblyTitle>
<VersionPrefix>3.4.1</VersionPrefix>
<VersionPrefix>3.4.2</VersionPrefix>
<Authors>ExcelDataReader developers</Authors>
<TargetFrameworks>net20;net35;netstandard2.0</TargetFrameworks>
<AssemblyName>ExcelDataReader.DataSet</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion src/ExcelDataReader/Core/CsvFormat/CsvParser.cs
Expand Up @@ -75,7 +75,7 @@ public void ParseBuffer(byte[] bytes, int offset, int count, out List<List<strin

public void Flush(out List<List<string>> rows)
{
if (State != CsvState.PreValue)
if (ValueResult.Length > 0 || RowResult.Count > 0)
{
AddValueToRow();
AddRowToResult();
Expand Down
5 changes: 3 additions & 2 deletions src/ExcelDataReader/Core/OpenXmlFormat/XlsxWorkbook.cs
Expand Up @@ -7,6 +7,7 @@ internal class XlsxWorkbook : IWorkbook<XlsxWorksheet>
{
private const string NsSpreadsheetMl = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
private const string NsRelationship = "http://schemas.openxmlformats.org/package/2006/relationships";
private const string NsDocumentRelationship = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
private const string ElementSst = "sst";
private const string ElementSheets = "sheets";
private const string ElementSheet = "sheet";
Expand All @@ -22,7 +23,7 @@ internal class XlsxWorkbook : IWorkbook<XlsxWorksheet>
private const string AttributeSheetId = "sheetId";
private const string AttributeVisibleState = "state";
private const string AttributeName = "name";
private const string AttributeRelationshipId = "r:id";
private const string AttributeRelationshipId = "id";

private const string ElementRelationship = "Relationship";
private const string ElementRelationships = "Relationships";
Expand Down Expand Up @@ -179,7 +180,7 @@ private void ReadSheets(XmlReader reader)
Sheets.Add(new XlsxBoundSheet(
reader.GetAttribute(AttributeName),
int.Parse(reader.GetAttribute(AttributeSheetId)),
reader.GetAttribute(AttributeRelationshipId),
reader.GetAttribute(AttributeRelationshipId, NsDocumentRelationship),
reader.GetAttribute(AttributeVisibleState)));
reader.Skip();
}
Expand Down
2 changes: 1 addition & 1 deletion src/ExcelDataReader/ExcelDataReader.csproj
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Lightweight and fast library written in C# for reading Microsoft Excel files (2.0-2007).</Description>
<AssemblyTitle>ExcelDataReader</AssemblyTitle>
<VersionPrefix>3.4.1</VersionPrefix>
<VersionPrefix>3.4.2</VersionPrefix>
<Authors>ExcelDataReader developers</Authors>
<TargetFrameworks>net20;net45;netstandard1.3;netstandard2.0</TargetFrameworks>
<AssemblyName>ExcelDataReader</AssemblyName>
Expand Down
1 change: 1 addition & 0 deletions test/ExcelDataReader.Tests/Configuration.cs
Expand Up @@ -176,6 +176,7 @@ internal static class Configuration
{ "Test_git_issue_324", "Test_git_issue_324.xlsx" },
{ "Test_git_issue_329_error.xlsx", "Test_git_issue_329_error.xlsx" },
{ "Test_git_issue_329_error.xls", "Test_git_issue_329_error.xls" },
{ "test_git_issue_354.xlsx", "test_git_issue_354.xlsx" },
};

public static Stream GetTestWorkbook(string key)
Expand Down
20 changes: 20 additions & 0 deletions test/ExcelDataReader.Tests/ExcelCsvReaderTest.cs
Expand Up @@ -323,5 +323,25 @@ public void GitIssue_333_EAN_Quotes()
Assert.AreEqual(24, reader.FieldCount);
}
}
[Test]
public void GitIssue_351_Last_Line_Without_Line_Feed()
{
using (var strm = new MemoryStream())
{
using (var writer = new StreamWriter(strm, Encoding.UTF8))
{
writer.NewLine = "\n";
writer.WriteLine("5;6;1;Test");
writer.Write("Test;;;");
writer.Flush();
using (var reader = ExcelReaderFactory.CreateCsvReader(strm))
{
var ds = reader.AsDataSet();
Assert.AreEqual(2, ds.Tables[0].Rows.Count);
Assert.AreEqual(4, reader.FieldCount);
}
}
}
}
}
}
12 changes: 12 additions & 0 deletions test/ExcelDataReader.Tests/ExcelOpenXmlReaderTest.cs
Expand Up @@ -1511,5 +1511,17 @@ public void GitIssue_329_Error()
Assert.AreEqual(1, reader.RowCount);
}
}

[TestMethod]
public void GitIssue_354()
{
using (var reader = ExcelReaderFactory.CreateOpenXmlReader(Configuration.GetTestWorkbook("test_git_issue_354.xlsx")))
{
var result = reader.AsDataSet().Tables[0];

Assert.AreEqual(1, result.Rows.Count);
Assert.AreEqual("cell data", result.Rows[0][0]);
}
}
}
}
Binary file added test/Resources/test_git_issue_354.xlsx
Binary file not shown.

0 comments on commit 6793a9c

Please sign in to comment.