mirror of
https://gitee.com/dotnetchina/MiniExcel.git
synced 2024-12-02 03:47:41 +08:00
Merge branch 'master' of https://github.com/shps951023/MiniExcel
This commit is contained in:
commit
027bf33ca1
17
README.md
17
README.md
@ -108,7 +108,7 @@ Logic : create a total of 10,000,000 "HelloWorld" excel
|
||||
| OpenXmlSdk | 'OpenXmlSdk Create Xlsx' | 2,621 MB | 42.47399 sec |
|
||||
| ClosedXml | 'ClosedXml Create Xlsx' | 7,141 MB | 140.93992 sec |
|
||||
|
||||
### Excel Query <a name="getstart1"></a>
|
||||
### Excel Query/Import <a name="getstart1"></a>
|
||||
|
||||
#### 1. Execute a query and map the results to a strongly typed IEnumerable [[Try it]](https://dotnetfiddle.net/w5WD1J)
|
||||
|
||||
@ -291,7 +291,7 @@ support variable length and width multi-row and column filling
|
||||
|
||||
|
||||
|
||||
### Create Excel <a name="getstart2"></a>
|
||||
### Create/Export Excel <a name="getstart2"></a>
|
||||
|
||||
1. Must be a non-abstract type with a public parameterless constructor .
|
||||
|
||||
@ -339,6 +339,19 @@ MiniExcel.SaveAs(path, reader);
|
||||
|
||||
![image](https://user-images.githubusercontent.com/12729184/121275378-149a5e80-c8bc-11eb-85fe-5453552134f0.png)
|
||||
|
||||
DataReader export multiple sheets (recommand by Dapper ExecuteReader)
|
||||
|
||||
```csharp
|
||||
using (var cnn = Connection)
|
||||
{
|
||||
cnn.Open();
|
||||
var sheets = new Dictionary<string,object>();
|
||||
sheets.Add("sheet1", cnn.ExecuteReader("select 1 id"));
|
||||
sheets.Add("sheet2", cnn.ExecuteReader("select 2 id"));
|
||||
MiniExcel.SaveAs("Demo.xlsx", sheets);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 4. Datatable
|
||||
|
@ -108,8 +108,7 @@ Benchmark History : [Link](https://github.com/shps951023/MiniExcel/issues/276)
|
||||
|
||||
|
||||
|
||||
|
||||
### 读 Excel <a name="getstart1"></a>
|
||||
### 读/导入 Excel <a name="getstart1"></a>
|
||||
|
||||
|
||||
|
||||
@ -296,8 +295,7 @@ MiniExcel.Query(path,useHeaderRow:true,startCell:"B3")
|
||||
|
||||
|
||||
|
||||
|
||||
### 写 Excel <a name="getstart2"></a>
|
||||
### 写/导出 Excel <a name="getstart2"></a>
|
||||
|
||||
1. 必须是非abstract 类别有公开无参数构造函数
|
||||
2. MiniExcel SaveAs 支援 `IEnumerable参数延迟查询`,除非必要请不要使用 ToList 等方法读取全部数据到内存
|
||||
@ -336,7 +334,7 @@ output :
|
||||
|
||||
|
||||
|
||||
#### 3. IDataReader 参数
|
||||
#### 3. IDataReader
|
||||
|
||||
- 推荐使用,可以避免载入全部数据到内存
|
||||
|
||||
@ -346,6 +344,19 @@ MiniExcel.SaveAs(path, reader);
|
||||
|
||||
![image](https://user-images.githubusercontent.com/12729184/121275378-149a5e80-c8bc-11eb-85fe-5453552134f0.png)
|
||||
|
||||
推荐 DataReader 多表格导出方式(建议使用 Dapper ExecuteReader )
|
||||
|
||||
```csharp
|
||||
using (var cnn = Connection)
|
||||
{
|
||||
cnn.Open();
|
||||
var sheets = new Dictionary<string,object>();
|
||||
sheets.Add("sheet1", cnn.ExecuteReader("select 1 id"));
|
||||
sheets.Add("sheet2", cnn.ExecuteReader("select 2 id"));
|
||||
MiniExcel.SaveAs("Demo.xlsx", sheets);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 4. Datatable
|
||||
|
@ -108,7 +108,7 @@ Benchmark History : [Link](https://github.com/shps951023/MiniExcel/issues/276)
|
||||
|
||||
|
||||
|
||||
### 讀 Excel <a name="getstart1"></a>
|
||||
### 讀/導入 Excel <a name="getstart1"></a>
|
||||
|
||||
- 支持任何 stream 类型 : FileStream,MemoryStream
|
||||
|
||||
@ -293,7 +293,7 @@ MiniExcel.Query(path,useHeaderRow:true,startCell:"B3")
|
||||
|
||||
|
||||
|
||||
### 寫 Excel <a name="getstart2"></a>
|
||||
### 寫/導出 Excel <a name="getstart2"></a>
|
||||
|
||||
1. 必須是非abstract 類別有公開無參數構造函數
|
||||
2. MiniExcel SaveAs 支援 `IEnumerable參數延遲查詢`,除非必要請不要使用 ToList 等方法讀取全部資料到記憶體
|
||||
@ -336,7 +336,7 @@ output :
|
||||
|
||||
|
||||
|
||||
#### 3. IDataReader 參數
|
||||
#### 3. IDataReader
|
||||
|
||||
- 推薦使用,可以避免載入全部數據到記憶體
|
||||
|
||||
@ -346,6 +346,19 @@ MiniExcel.SaveAs(path, reader);
|
||||
|
||||
![image](https://user-images.githubusercontent.com/12729184/121275378-149a5e80-c8bc-11eb-85fe-5453552134f0.png)
|
||||
|
||||
推薦 DataReader 多表格導出方式(建議使用 Dapper ExecuteReader )
|
||||
|
||||
```csharp
|
||||
using (var cnn = Connection)
|
||||
{
|
||||
cnn.Open();
|
||||
var sheets = new Dictionary<string,object>();
|
||||
sheets.Add("sheet1", cnn.ExecuteReader("select 1 id"));
|
||||
sheets.Add("sheet2", cnn.ExecuteReader("select 2 id"));
|
||||
MiniExcel.SaveAs("Demo.xlsx", sheets);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 4. Datatable
|
||||
|
Loading…
Reference in New Issue
Block a user