Skip to content

Commit e86d2a4

Browse files
authored
Update README.md
1 parent 0c8ec41 commit e86d2a4

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ Ultra lightweight spreadsheet utility to display processed collections of data a
77
#### Features
88
+ Uses XLSX file format
99
+ Writes public properties of a collection into a dedicated worksheet
10-
+ Reads worksheet data into tuple enumerator
10+
+ Reads worksheet data into an enumerator(List)
1111
+ Supports multiple worksheets
1212
+ Auto fits columns for comfortable viewing
13+
+ Supports custom string formatting
14+
+ Supports color scale formatting
1315

1416
#### Tutorial
1517

@@ -18,10 +20,15 @@ Let's create an employee class to store in a spreadsheet.
1820
```cs
1921
class Employee
2022
{
21-
public string Name { get; set; }
22-
public string Position { get; set; }
23+
public string? Name { get; set; }
24+
public string? Position { get; set; }
25+
26+
[Format("0$")]
27+
[ColorScale("red", "#00FF00" /* green */)]
2328
public decimal Salary { get; set; }
2429

30+
public Employee() { }
31+
2532
public Employee(string name, string position, decimal salary)
2633
{
2734
Name = name;
@@ -37,6 +44,8 @@ Now we can make an array of company's employees.
3744
var employees = new[]
3845
{
3946
new Employee("John", "CEO", 10000),
47+
new Employee("Steve", "Manager", 6000),
48+
new Employee("Will", "Senior Software Engineer", 4000),
4049
new Employee("Kate", "Software Engineer", 2000),
4150
new Employee("Paul", "Quality Assurance", 1000)
4251
};
@@ -53,29 +62,20 @@ using (var spreadsheet = new Spreadsheet("Company.xlsx"))
5362

5463
Here is how this data looks in the spreadsheet.
5564

56-
<img src="https://user-images.githubusercontent.com/94010480/235367459-c488f500-2f01-440e-9653-e3a8f895550d.png" width="350" height="220" />
65+
<img src="https://github.com/Planktomas/SpreadsheetUtility/assets/94010480/155379da-b753-4069-a057-4022192345e5.png" width="350" height="220" />
5766

5867
And if we need to read some of that data back, we can do it too.
5968

6069
```cs
6170
using (var spreadsheet = new Spreadsheet("Company.xlsx"))
6271
{
63-
IEnumerable<(decimal Salary, string Position)> salaries;
64-
65-
salaries = spreadsheet.Read<decimal, string>(typeof(Employee),
66-
nameof(Employee.Salary), nameof(Employee.Position));
67-
}
68-
```
69-
70-
We can verify the results just to be sure we got the right data.
71-
72-
```cs
73-
foreach (var item in salaries)
74-
{
75-
Console.WriteLine($"Salary: {item.Salary} \t Position: {item.Position}");
72+
foreach (var employee in spreadsheet.Read<Employee>())
73+
{
74+
Console.WriteLine($"Salary: {employee.Salary} \t Position: {employee.Position}");
75+
}
7676
}
7777
```
7878

79-
<img src="https://user-images.githubusercontent.com/94010480/235367385-1bedc612-0d15-410e-b262-cb82b61601ae.png" width="400" height="90" />
79+
<img src="https://github.com/Planktomas/SpreadsheetUtility/assets/94010480/5354153c-b40e-436d-9619-9652f3082cc0.png" width="520" height="160" />
8080

8181
[You can review the whole tutorial here](https://github.com/Planktomas/SpreadsheetUtility/blob/main/Tutorial/Program.cs)

0 commit comments

Comments
 (0)