Skip to content

Commit

Permalink
[Unit Test] Issue 553
Browse files Browse the repository at this point in the history
  • Loading branch information
shps951023 committed Dec 27, 2023
1 parent bd1f7d5 commit 4baaf46
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,18 +403,6 @@ var table = new DataTable();
MiniExcel.SaveAs(path, table);
```

#### 5. Dapper Query

- `Not recommended`, it will load all data into memory, please use `ExecuteReader`

```csharp
using (var connection = GetConnection(connectionString))
{
var rows = connection.Query(@"select 'MiniExcel' as Column1,1 as Column2 union all select 'Github',2");
MiniExcel.SaveAs(path, rows);
}
```

#### 5. Dapper Query

Thanks @shaofing #552 , please use `CommandDefinition + CommandFlags.NoCache`
Expand Down
Binary file added samples/xlsx/TestIssue553.xlsx
Binary file not shown.
13 changes: 13 additions & 0 deletions tests/MiniExcelTests/MiniExcelIssueTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ public MiniExcelIssueTests(ITestOutputHelper output)
{
this.output = output;
}


[Fact]
public void TestIssue553()
{
var path = PathHelper.GetTempFilePath();
var templatePath = PathHelper.GetFile("xlsx/TestIssue553.xlsx");
var data = new { B = new[] {
new{ ITM=1 },new{ ITM=2 }, new{ ITM=3 },
} };
MiniExcel.SaveAsByTemplate(path, templatePath, data);
}

[Fact]
public void TestPR10()
{
Expand Down

0 comments on commit 4baaf46

Please sign in to comment.