Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion MiniExcel.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<File Path=".editorconfig" />
<File Path=".gitattributes" />
<File Path=".gitignore" />
<File Path="appveyor.yml" />
<File Path=".github\workflows\dotnet.yml" />
<File Path="LICENSE" />
<File Path="README.md" />
Expand Down
3 changes: 0 additions & 3 deletions README-V2.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
<a href="https://www.nuget.org/packages/MiniExcel">
<img src="https://img.shields.io/nuget/dt/MiniExcel.svg" alt="">
</a>
<a href="https://ci.appveyor.com/project/mini-software/miniexcel/branch/master">
<img src="https://ci.appveyor.com/api/projects/status/b2vustrwsuqx45f4/branch/master?svg=true" alt="Build status">
</a>
<a href="https://gitee.com/dotnetchina/MiniExcel">
<img src="https://gitee.com/dotnetchina/MiniExcel/badge/star.svg" alt="star">
</a>
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div align="center">
<p><a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/nuget/v/MiniExcel.svg" alt="NuGet"></a> <a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/nuget/dt/MiniExcel.svg" alt=""></a>
<a href="https://ci.appveyor.com/project/mini-software/miniexcel/branch/master"><img src="https://ci.appveyor.com/api/projects/status/b2vustrwsuqx45f4/branch/master?svg=true" alt="Build status"></a>
<a href="https://gitee.com/dotnetchina/MiniExcel"><img src="https://gitee.com/dotnetchina/MiniExcel/badge/star.svg" alt="star"></a> <a href="https://github.com/mini-software/MiniExcel" rel="nofollow"><img src="https://img.shields.io/github/stars/mini-software/MiniExcel?logo=github" alt="GitHub stars"></a>
<a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/badge/.NET-%3E%3D%204.5-red.svg" alt="version"></a>
<a href="https://deepwiki.com/mini-software/MiniExcel"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
Expand Down
1 change: 0 additions & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div align="center">
<p><a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/nuget/v/MiniExcel.svg" alt="NuGet"></a> <a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/nuget/dt/MiniExcel.svg" alt=""></a>
<a href="https://ci.appveyor.com/project/mini-software/miniexcel/branch/master"><img src="https://ci.appveyor.com/api/projects/status/b2vustrwsuqx45f4/branch/master?svg=true" alt="Build status"></a>
<a href="https://gitee.com/dotnetchina/MiniExcel"><img src="https://gitee.com/dotnetchina/MiniExcel/badge/star.svg" alt="star"></a> <a href="https://github.com/mini-software/MiniExcel" rel="nofollow"><img src="https://img.shields.io/github/stars/mini-software/MiniExcel?logo=github" alt="GitHub stars"></a>
<a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/badge/.NET-%3E%3D%204.5-red.svg" alt="version"></a>
<a href="https://deepwiki.com/mini-software/MiniExcel"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
Expand Down
23 changes: 0 additions & 23 deletions appveyor.yml

This file was deleted.

1 change: 0 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<div align="center">
<p><a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/nuget/v/MiniExcel.svg" alt="NuGet"></a> <a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/nuget/dt/MiniExcel.svg" alt=""></a>
<a href="https://ci.appveyor.com/project/mini-software/miniexcel/branch/master"><img src="https://ci.appveyor.com/api/projects/status/b2vustrwsuqx45f4/branch/master?svg=true" alt="Build status"></a>
<a href="https://gitee.com/dotnetchina/MiniExcel"><img src="https://gitee.com/dotnetchina/MiniExcel/badge/star.svg" alt="star"></a> <a href="https://github.com/mini-software/MiniExcel" rel="nofollow"><img src="https://img.shields.io/github/stars/mini-software/MiniExcel?logo=github" alt="GitHub stars"></a>
<a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/badge/.NET-%3E%3D%204.5-red.svg" alt="version"></a>
</p>
Expand Down
1 change: 0 additions & 1 deletion docs/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

<div align="center">
<p><a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/nuget/v/MiniExcel.svg" alt="NuGet"></a> <a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/nuget/dt/MiniExcel.svg" alt=""></a>
<a href="https://ci.appveyor.com/project/mini-software/miniexcel/branch/master"><img src="https://ci.appveyor.com/api/projects/status/b2vustrwsuqx45f4/branch/master?svg=true" alt="Build status"></a>
<a href="https://gitee.com/dotnetchina/MiniExcel"><img src="https://gitee.com/dotnetchina/MiniExcel/badge/star.svg" alt="star"></a> <a href="https://github.com/mini-software/MiniExcel" rel="nofollow"><img src="https://img.shields.io/github/stars/mini-software/MiniExcel?logo=github" alt="GitHub stars"></a>
<a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/badge/.NET-%3E%3D%204.5-red.svg" alt="version"></a>
</p>
Expand Down
1 change: 0 additions & 1 deletion docs/README.zh-Hant.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

<div align="center">
<p><a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/nuget/v/MiniExcel.svg" alt="NuGet"></a> <a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/nuget/dt/MiniExcel.svg" alt=""></a>
<a href="https://ci.appveyor.com/project/mini-software/miniexcel/branch/master"><img src="https://ci.appveyor.com/api/projects/status/b2vustrwsuqx45f4/branch/master?svg=true" alt="Build status"></a>
<a href="https://gitee.com/dotnetchina/MiniExcel"><img src="https://gitee.com/dotnetchina/MiniExcel/badge/star.svg" alt="star"></a> <a href="https://github.com/mini-software/MiniExcel" rel="nofollow"><img src="https://img.shields.io/github/stars/mini-software/MiniExcel?logo=github" alt="GitHub stars"></a>
<a href="https://www.nuget.org/packages/MiniExcel"><img src="https://img.shields.io/badge/.NET-%3E%3D%204.5-red.svg" alt="version"></a>
</p>
Expand Down
3 changes: 0 additions & 3 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
<a href="https://www.nuget.org/packages/MiniExcel">
<img src="https://img.shields.io/nuget/dt/MiniExcel.svg" alt="">
</a>
<a href="https://ci.appveyor.com/project/mini-software/miniexcel/branch/master">
<img src="https://ci.appveyor.com/api/projects/status/b2vustrwsuqx45f4/branch/master?svg=true" alt="Build status">
</a>
<a href="https://gitee.com/dotnetchina/MiniExcel">
<img src="https://gitee.com/dotnetchina/MiniExcel/badge/star.svg" alt="star">
</a>
Expand Down
103 changes: 103 additions & 0 deletions tests/MiniExcel.Csv.Tests/Issues/GiteeIssuesTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
namespace MiniExcelLib.Csv.Tests.Issues;

public class GiteeIssuesTests
{
private readonly CsvExporter _csvExporter = MiniExcel.Exporters.GetCsvExporter();

// https://gitee.com/dotnetchina/MiniExcel/issues/I4X92G
[Fact]
public void TestIssueI4X92G()
{
using var file = AutoDeletingPath.Create(ExcelType.Csv);
var path = file.ToString();

{
var value = new[]
{
new { ID = 1, Name = "Jack", InDate = new DateTime(2021,01,03)},
new { ID = 2, Name = "Henry", InDate = new DateTime(2020,05,03)}
};
_csvExporter.Export(path, value);
var content = File.ReadAllText(path);
Assert.Equal(
"""
ID,Name,InDate
1,Jack,"2021-01-03 00:00:00"
2,Henry,"2020-05-03 00:00:00"

""",
content);
}
{
var value = new { ID = 3, Name = "Mike", InDate = new DateTime(2021, 04, 23) };
var rowsWritten = _csvExporter.Append(path, value);
Assert.Equal(1, rowsWritten);

var content = File.ReadAllText(path);
Assert.Equal(
"""
ID,Name,InDate
1,Jack,"2021-01-03 00:00:00"
2,Henry,"2020-05-03 00:00:00"
3,Mike,"2021-04-23 00:00:00"

""",
content);
}
{
var value = new[]
{
new { ID=4,Name ="Frank",InDate=new DateTime(2021,06,07)},
new { ID=5,Name ="Gloria",InDate=new DateTime(2022,05,03)},
};
var rowsWritten = _csvExporter.Append(path, value);
Assert.Equal(2, rowsWritten);

var content = File.ReadAllText(path);
Assert.Equal(
"""
ID,Name,InDate
1,Jack,"2021-01-03 00:00:00"
2,Henry,"2020-05-03 00:00:00"
3,Mike,"2021-04-23 00:00:00"
4,Frank,"2021-06-07 00:00:00"
5,Gloria,"2022-05-03 00:00:00"

""",
content);
}
}

[Fact]
public void TestIssueI4Wda9()
{
using var path = AutoDeletingPath.Create(ExcelType.Csv);
var value = new DataTable();
{
value.Columns.Add("\"name\"");
value.Rows.Add("\"Jack\"");
}

_csvExporter.Export(path.ToString(), value);
Assert.Equal("\"\"\"name\"\"\"\r\n\"\"\"Jack\"\"\"\r\n", File.ReadAllText(path.ToString()));
}

// Using stream.SaveAs will close the Stream automatically when Specifying excelType
// https://gitee.com/dotnetchina/MiniExcel/issues/I57WMM
[Fact]
public void TestIssueGiteeI57()
{
Dictionary<string, object>[] sheets = [new() { ["ID"] = "0001", ["Name"] = "Jack" }];
using var stream = new MemoryStream();

var config = new CsvConfiguration { StreamWriterFunc = x => new StreamWriter(x, Encoding.Default, leaveOpen: true) };
_csvExporter.Export(stream, sheets, configuration: config);
stream.Seek(0, SeekOrigin.Begin);

// convert stream to string
using var reader = new StreamReader(stream);
var text = reader.ReadToEnd();

Assert.Equal("ID,Name\r\n0001,Jack\r\n", text);
}
}
Loading
Loading