Problem with multi-line when using Query func
Excel Type
- [x] XLSX
- [x] XLSM
- [X] CSV
- [x] OTHER
Upload Excel File
e.g : .NET Fiddle
MiniExcel Version
1.31
Description
I wanted to import a CSV file in my project by reading the infos of the file and I jumped lines in my cells and I've seen that I would have more lines found than expected.
So when you put in a cell a retrun line you have a trouble, your code create a new object instead of adding the cell with the x jumping lines in the current object.
Check the .NET fiddle link and run it to understand easily what i'm meaning.
MiniExcel
CSV helper :
Office
Updated :
We need to overwrite readline method to check the row contains the \n and " or not
[Fact]
public void TestIssue507()
{
var path = PathHelper.GetTempFilePath("TestIssue142.csv");
var values = new[] {
new { A = "Github", B = DateTime.Parse("2021-01-01") },
new { A = "Microsoft \nTest", B = DateTime.Parse("2021-02-01") }
};
var config = new CsvConfiguration()
{
AlwaysQuote = true
};
// create
using (var stream = File.Create(path))
stream.SaveAs(values, excelType: ExcelType.CSV, configuration: config);
Console.WriteLine(File.ReadAllText(path));
// read
var getRowsInfo = MiniExcel.Query(path, true, excelType: ExcelType.CSV, configuration: config).ToArray();
}
The problem is when I want to use the Query Method from your lib, it's not working, "Microsoft Test" doesn't go in the same object but it is split in two differents object which is wrong. Take a look at the fiddle back. When I dump the result and look at the Console.