Skip to content

Commit 379328a

Browse files
committed
1.26.3
- [OPT] Export default buffersize from 1024 bytes -> 1024 * 512 bytes - [New] Export support custom buffersize - [New] SaveAsByTemplate number use InvariantCulture (via @psxbox)
1 parent 5e24582 commit 379328a

12 files changed

+78
-9
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,14 @@ MiniExcel.Query(path, configuration: config);
11141114
```
11151115

11161116

1117+
#### 4. Custom Buffer Size
1118+
```csharp
1119+
public abstract class Configuration : IConfiguration
1120+
{
1121+
public int BufferSize { get; set; } = 1024 * 512;
1122+
}
1123+
```
1124+
11171125

11181126

11191127

README.zh-CN.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,13 @@ MiniExcel.SaveAs(path, value, configuration: config);
11121112
MiniExcel.Query(path, configuration: config);
11131113
```
11141114

1115+
#### 4. 导出自定义 Buffer Size
1116+
```csharp
1117+
public abstract class Configuration : IConfiguration
1118+
{
1119+
public int BufferSize { get; set; } = 1024 * 512;
1120+
}
1121+
```
11151122

11161123

11171124

README.zh-Hant.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,14 @@ MiniExcel.SaveAs(path, value, configuration: config);
11111111
MiniExcel.Query(path,configuration: config);
11121112
```
11131113

1114+
#### 4. 導出自定義 Buffer Size
1115+
```csharp
1116+
public abstract class Configuration : IConfiguration
1117+
{
1118+
public int BufferSize { get; set; } = 1024 * 512;
1119+
}
1120+
```
1121+
11141122

11151123

11161124
### 範例

docs/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@
2222

2323
---
2424

25+
### 1.26.3
26+
- [OPT] Export default buffersize from 1024 bytes -> 1024 * 512 bytes
27+
- [New] Export support custom buffersize
28+
- [New] SaveAsByTemplate number use InvariantCulture (via @psxbox)
2529

2630
### 1.26.2
31+
2732
- [Bug] Fixed DynamicColumnAttribute Ignore, Index error #377
2833

2934
### 1.26.1

docs/README.zh-CN.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525

2626
---
2727

28+
29+
### 1.26.3
30+
- [OPT] Export 预设 buffersize 从 1024 bytes -> 1024 * 512 bytes
31+
- [New] Export 支持自定义 buffersize
32+
- [New] SaveAsByTemplate number 改为 InvariantCulture (via @psxbox)
33+
34+
2835
### 1.26.2
2936
- [Bug] 修正 DynamicColumnAttribute Ignore, Index 问题 #377
3037

docs/README.zh-Hant.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424

2525
---
2626

27+
### 1.26.3
28+
- [OPT] Export 預設 buffersize 從 1024 bytes -> 1024 * 512 bytes
29+
- [New] Export 支持自定義 buffersize
30+
- [New] SaveAsByTemplate number 改為 InvariantCulture (via @psxbox)
31+
2732
### 1.26.2
2833
- [Bug] 修正 DynamicColumnAttribute Ignore, Index 問題 #377
2934

src/MiniExcel/IConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ public abstract class Configuration : IConfiguration
88
{
99
public CultureInfo Culture { get; set; } = CultureInfo.InvariantCulture;
1010
public DynamicExcelColumn[] DynamicColumns { get; set; }
11+
public int BufferSize { get; set; } = 1024 * 512;
1112
}
1213
}

src/MiniExcel/MiniExcelLibs.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net45;netstandard2.0;net5.0</TargetFrameworks>
4-
<Version>1.26.2</Version>
4+
<Version>1.26.3</Version>
55
</PropertyGroup>
66
<PropertyGroup>
77
<AssemblyName>MiniExcel</AssemblyName>

src/MiniExcel/OpenXml/ExcelOpenXmlSheetWriter.DefualtOpenXml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ private void CreateZipEntry(string path,string contentType,string content)
193193
{
194194
ZipArchiveEntry entry = _archive.CreateEntry(path);
195195
using (var zipStream = entry.Open())
196-
using (MiniExcelStreamWriter writer = new MiniExcelStreamWriter(zipStream, _utf8WithBom))
196+
using (MiniExcelStreamWriter writer = new MiniExcelStreamWriter(zipStream, _utf8WithBom,_configuration.BufferSize))
197197
writer.Write(content);
198198
if(!string.IsNullOrEmpty(contentType))
199199
_zipDictionary.Add(path, new ZipPackageInfo(entry, contentType));

src/MiniExcel/OpenXml/ExcelOpenXmlSheetWriter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private void CreateSheetXml(object value, string sheetPath)
114114
{
115115
ZipArchiveEntry entry = _archive.CreateEntry(sheetPath);
116116
using (var zipStream = entry.Open())
117-
using (MiniExcelStreamWriter writer = new MiniExcelStreamWriter(zipStream, _utf8WithBom))
117+
using (MiniExcelStreamWriter writer = new MiniExcelStreamWriter(zipStream, _utf8WithBom,_configuration.BufferSize))
118118
{
119119
if (value == null)
120120
{
@@ -750,7 +750,7 @@ private void GenerateEndXml()
750750
sb.Append("</Types>");
751751
ZipArchiveEntry entry = _archive.CreateEntry("[Content_Types].xml");
752752
using (var zipStream = entry.Open())
753-
using (MiniExcelStreamWriter writer = new MiniExcelStreamWriter(zipStream, _utf8WithBom))
753+
using (MiniExcelStreamWriter writer = new MiniExcelStreamWriter(zipStream, _utf8WithBom, _configuration.BufferSize))
754754
writer.Write(sb.ToString());
755755
}
756756
}

0 commit comments

Comments
 (0)