File tree Expand file tree Collapse file tree 6 files changed +145
-3
lines changed Expand file tree Collapse file tree 6 files changed +145
-3
lines changed Original file line number Diff line number Diff line change @@ -561,6 +561,68 @@ memoryStream.MergeSameCells(path);
561
561
![ before_merge_cells] ( https://user-images.githubusercontent.com/38832863/219970175-913b3d04-d714-4279-a7a4-6cefb7aa6ce8.PNG )
562
562
![ after_merge_cells] ( https://user-images.githubusercontent.com/38832863/219970176-e78c491a-2f90-45a7-a4a2-425c5708d38c.PNG )
563
563
564
+ #### 13. 是否写入 null values cell
565
+
566
+ 预设:
567
+
568
+ ``` csharp
569
+ DataTable dt = new DataTable ();
570
+
571
+ /* ... */
572
+
573
+ DataRow dr = dt .NewRow ();
574
+
575
+ dr [" Name1" ] = " Somebody once" ;
576
+ dr [" Name2" ] = null ;
577
+ dr [" Name3" ] = " told me." ;
578
+
579
+ dt .Rows .Add (dr );
580
+
581
+ MiniExcel .SaveAs (@" C:\temp\Book1.xlsx" , dt );
582
+ ```
583
+
584
+ ![ image] ( https://user-images.githubusercontent.com/31481586/241419441-c4f27e8f-3f87-46db-a10f-08665864c874.png )
585
+
586
+ ``` xml
587
+ <x : row r =" 2" >
588
+ <x : c r =" A2" t =" str" s =" 2" >
589
+ <x : v >Somebody once</x : v >
590
+ </x : c >
591
+ <x : c r =" B2" t =" str" s =" 2" >
592
+ <x : v ></x : v >
593
+ </x : c >
594
+ <x : c r =" C2" t =" str" s =" 2" >
595
+ <x : v >told me.</x : v >
596
+ </x : c >
597
+ </x : row >
598
+ ```
599
+
600
+ 设定不写入:
601
+
602
+ ``` csharp
603
+ OpenXmlConfiguration configuration = new OpenXmlConfiguration ()
604
+ {
605
+ EnableWriteNullValueCell = false // Default value is true.
606
+ };
607
+
608
+ MiniExcel .SaveAs (@" C:\temp\Book1.xlsx" , dt , configuration : configuration );
609
+ ```
610
+
611
+ ![ image] ( https://user-images.githubusercontent.com/31481586/241419455-3c0aec8a-4e5f-4d83-b7ec-6572124c165d.png )
612
+
613
+
614
+ ``` xml
615
+ <x : row r =" 2" >
616
+ <x : c r =" A2" t =" str" s =" 2" >
617
+ <x : v >Somebody once</x : v >
618
+ </x : c >
619
+ <x : c r =" B2" s =" 2" ></x : c >
620
+ <x : c r =" C2" t =" str" s =" 2" >
621
+ <x : v >told me.</x : v >
622
+ </x : c >
623
+ </x : row >
624
+ ```
625
+
564
626
565
627
566
628
Original file line number Diff line number Diff line change @@ -557,6 +557,70 @@ memoryStream.MergeSameCells(path);
557
557
558
558
559
559
560
+ #### 13. 是否寫入 null values cell
561
+
562
+ 預設:
563
+
564
+ ``` csharp
565
+ DataTable dt = new DataTable ();
566
+
567
+ /* ... */
568
+
569
+ DataRow dr = dt .NewRow ();
570
+
571
+ dr [" Name1" ] = " Somebody once" ;
572
+ dr [" Name2" ] = null ;
573
+ dr [" Name3" ] = " told me." ;
574
+
575
+ dt .Rows .Add (dr );
576
+
577
+ MiniExcel .SaveAs (@" C:\temp\Book1.xlsx" , dt );
578
+ ```
579
+
580
+ ![ image] ( https://user-images.githubusercontent.com/31481586/241419441-c4f27e8f-3f87-46db-a10f-08665864c874.png )
581
+
582
+ ``` xml
583
+ <x : row r =" 2" >
584
+ <x : c r =" A2" t =" str" s =" 2" >
585
+ <x : v >Somebody once</x : v >
586
+ </x : c >
587
+ <x : c r =" B2" t =" str" s =" 2" >
588
+ <x : v ></x : v >
589
+ </x : c >
590
+ <x : c r =" C2" t =" str" s =" 2" >
591
+ <x : v >told me.</x : v >
592
+ </x : c >
593
+ </x : row >
594
+ ```
595
+
596
+ 設定不寫入:
597
+
598
+ ``` csharp
599
+ OpenXmlConfiguration configuration = new OpenXmlConfiguration ()
600
+ {
601
+ EnableWriteNullValueCell = false // Default value is true.
602
+ };
603
+
604
+ MiniExcel .SaveAs (@" C:\temp\Book1.xlsx" , dt , configuration : configuration );
605
+ ```
606
+
607
+ ![ image] ( https://user-images.githubusercontent.com/31481586/241419455-3c0aec8a-4e5f-4d83-b7ec-6572124c165d.png )
608
+
609
+
610
+ ``` xml
611
+ <x : row r =" 2" >
612
+ <x : c r =" A2" t =" str" s =" 2" >
613
+ <x : v >Somebody once</x : v >
614
+ </x : c >
615
+ <x : c r =" B2" s =" 2" ></x : c >
616
+ <x : c r =" C2" t =" str" s =" 2" >
617
+ <x : v >told me.</x : v >
618
+ </x : c >
619
+ </x : row >
620
+ ```
621
+
622
+
623
+
560
624
### 模板填充 Excel <a name =" getstart3 " ></a >
561
625
562
626
- 宣告方式類似 Vue 模板 ` {{變量名稱}} ` , 或是集合渲染 ` {{集合名稱.欄位名稱}} `
Original file line number Diff line number Diff line change 22
22
23
23
---
24
24
25
- ### 1.30.4
26
- - [ New] Support skipping null values when writing to Excel (via @0MG-DEN )
25
+ ### 1.31.0
26
+ - [ New] Support Fields #490 (via @jsgervais )
27
+ - [ New] Support skipping null values when writing to Excel #497 (via @0MG-DEN )
28
+ - [ Bug] Fix calc chain.xml #491 (via @ArgoZhang )
29
+ - [ Bug] Support some sheet ` /xl ` location error #494 (via @ArgoZhang )
27
30
28
31
### 1.30.3
29
32
- [ New] support if/else statements inside cell (via @eynarhaji )
Original file line number Diff line number Diff line change 27
27
28
28
29
29
30
+ ### 1.31.0
31
+
32
+ - [ New] 支持 Fields #490 (via @jsgervais )
33
+ - [ New] 支持是否写入 null values cell #497 (via @0MG-DEN )
34
+ - [ Bug] 修复calc chain.xml 问题 #491 (via @ArgoZhang )
35
+ - [ Bug] 修复特定文件 ` /xl ` 定位错误 #494 (via @ArgoZhang )
36
+
30
37
### 1.30.3
31
38
- [ New] 模版支持 if/else 单元格语句 (via @eynarhaji )
32
39
Original file line number Diff line number Diff line change 24
24
25
25
---
26
26
27
+ ### 1.31.0
28
+ - [ New] 支持 Fields #490 (via @jsgervais )
29
+ - [ New] 支持是否寫入 null values cell #497 (via @0MG-DEN )
30
+ - [ Bug] 修復calc chain.xml 問題 #491 (via @ArgoZhang )
31
+ - [ Bug] 修復特定文件 ` /xl ` 定位錯誤 #494 (via @ArgoZhang )
32
+
27
33
### 1.30.3
28
34
- [ New] 模版支持 if/else 單元格語句 (via @eynarhaji )
29
35
Original file line number Diff line number Diff line change 1
1
<Project Sdk =" Microsoft.NET.Sdk" >
2
2
<PropertyGroup >
3
3
<TargetFrameworks >net45;netstandard2.0</TargetFrameworks >
4
- <Version >1.30.3 </Version >
4
+ <Version >1.31.0 </Version >
5
5
</PropertyGroup >
6
6
<PropertyGroup >
7
7
<AssemblyName >MiniExcel</AssemblyName >
You can’t perform that action at this time.
0 commit comments