Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Fei-Sheng-Wu committed Aug 17, 2020
1 parent 3500b9d commit b6fa45b
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# DatasToExcel

[![Target Framework](https://img.shields.io/badge/%2ENet%20Core-3.0-green.svg)](https://docs.microsoft.com/en-us/dotnet/core/about)
[![Lincense](https://img.shields.io/badge/Lincense-MIT-orange.svg)](https://github.com/Fei-Sheng-Wu/DatasToExcel/blob/1.0.0/LICENSE.txt)

> A 2D array to Excel file converter, support header first row and fixed headers. It uses .Net Core 3.0 as framework and only depends on the Open Xml SDK.
## Dependencies

**.Net Core** >= 3.0
**DocumentFormat.OpenXml** = 2.10.1

## Main Features

- [x] 2D array to Excel
- [x] Header first row (optional)
- [x] Fixed first row (optional)

## How to Use

Create a 2D array first.

```c#
string[,] datas = new string[,]
{
{ "Name", "Country", "Age", "Career" },
{ "Helen", "U.S.", "21", "Police" },
{ "Jucia", "Canada", "34", "Dancer" },
{ "Erik", "Canada", "13", "Student" },
{ "Bob", "British", "26", "Business person" },
{ "Nancy", "Russia", "64", "Fisherman" },
};
```

And convert it to Excel and save to a fixed path.

```c#
datas.GenerateExcel(filename); //Do not header first row
datas.GenerateExcel(filename, true); //Header first row
```

Or save it to a memory stream.

```c#
//Option 1
MemoryStream ms = datas.GenerateExcel(); //Do not header first row
MemoryStream ms = datas.GenerateExcel(true); //Header first row
//Option 2
using (MemoryStream ms = new MemoryStream())
{
datas.GenerateExcel(ms); //Do not header first row
datas.GenerateExcel(ms, true); //Header first row
}
```

## License

This project is under the [MIT License](https://github.com/Fei-Sheng-Wu/DatasToExcel/blob/1.0.0/LICENSE.txt).

0 comments on commit b6fa45b

Please sign in to comment.