Skip to content

Commit 75933d3

Browse files
committed
.
1 parent afbcd15 commit 75933d3

13 files changed

+401
-31
lines changed

docs/intro.include.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Extends [Verify](https://github.com/VerifyTests/Verify) to allow verification of Excel documents via [Sylvan.Data.Excel](https://github.com/MarkPflug/Sylvan.Data.Excel/).
1+
Extends [Verify](https://github.com/VerifyTests/Verify) to allow verification of Excel documents via [OpenXML](https://github.com/dotnet/Open-XML-SDK/).

docs/zzz.include.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### Entity Framework Extensions
22

3-
[Entity Framework Extensions](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.Sylvan.Data.Excel) is a major sponsor and is proud to contribute to the development this project.
3+
[Entity Framework Extensions](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.OpenXML) is a major sponsor and is proud to contribute to the development this project.
44

5-
[![Entity Framework Extensions](https://raw.githubusercontent.com/VerifyTests/Verify.Sylvan.Data.Excel/refs/heads/main/docs/zzz.png)](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.Sylvan.Data.Excel)
5+
[![Entity Framework Extensions](https://raw.githubusercontent.com/VerifyTests/Verify.OpenXML/refs/heads/main/docs/zzz.png)](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.OpenXML)

readme.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
# <img src="/src/icon.png" height="30px"> Verify.Sylvan.Data.Excel
1+
# <img src="/src/icon.png" height="30px"> Verify.OpenXML
22

33
[![Discussions](https://img.shields.io/badge/Verify-Discussions-yellow?svg=true&label=)](https://github.com/orgs/VerifyTests/discussions)
4-
[![Build status](https://ci.appveyor.com/api/projects/status/q1eqcnbptyjl24hp?svg=true)](https://ci.appveyor.com/project/SimonCropp/verify-sylvan-data-excel)
5-
[![NuGet Status](https://img.shields.io/nuget/v/Verify.Sylvan.Data.Excel.svg)](https://www.nuget.org/packages/Verify.Sylvan.Data.Excel/)
4+
[![Build status](https://ci.appveyor.com/api/projects/status/q1eqcnbptyjl24hp?svg=true)](https://ci.appveyor.com/project/SimonCropp/verify-openxml)
5+
[![NuGet Status](https://img.shields.io/nuget/v/Verify.OpenXML.svg)](https://www.nuget.org/packages/Verify.OpenXML/)
66

7-
Code provided by Cédric Luthi https://github.com/0xced
7+
Extends [Verify](https://github.com/VerifyTests/Verify) to allow verification of Excel documents via [OpenXML](https://github.com/dotnet/Open-XML-SDK/).<!-- singleLineInclude: intro. path: /docs/intro.include.md -->
88

9-
Extends [Verify](https://github.com/VerifyTests/Verify) to allow verification of Excel documents via [Sylvan.Data.Excel](https://github.com/MarkPflug/Sylvan.Data.Excel/).<!-- singleLineInclude: intro. path: /docs/intro.include.md -->
10-
11-
Converts Excel documents (xls, xlsb and xlsx) to csv for verification.
9+
Converts Excel documents (xlsx) to csv for verification.
1210

1311
**See [Milestones](../../milestones?state=closed) for release notes.**
1412

13+
1514

1615
## Sponsors
1716

1817

1918
### Entity Framework Extensions<!-- include: zzz. path: /docs/zzz.include.md -->
2019

21-
[Entity Framework Extensions](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.Sylvan.Data.Excel) is a major sponsor and is proud to contribute to the development this project.
20+
[Entity Framework Extensions](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.OpenXML) is a major sponsor and is proud to contribute to the development this project.
2221

23-
[![Entity Framework Extensions](https://raw.githubusercontent.com/VerifyTests/Verify.Sylvan.Data.Excel/refs/heads/main/docs/zzz.png)](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.Sylvan.Data.Excel)<!-- endInclude -->
22+
[![Entity Framework Extensions](https://raw.githubusercontent.com/VerifyTests/Verify.OpenXML/refs/heads/main/docs/zzz.png)](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.OpenXML)<!-- endInclude -->
2423

2524

2625
## NuGet
2726

28-
* https://nuget.org/packages/Verify.Sylvan.Data.Excel
27+
* https://nuget.org/packages/Verify.OpenXML
2928

3029

3130
## Usage
@@ -98,12 +97,12 @@ public Task VerifySpreadsheetDocument()
9897
<a id='snippet-Samples.VerifyExcel.verified.csv'></a>
9998
```csv
10099
0,First Name,Last Name,Gender,Country,Date,Age,Id,Formula
101-
1,Dulce,Abril,Female,United States,2017-10-15 00:00:00,32,1562,G2+H21594
102-
2,Mara,Hashimoto,Female,Great Britain,2016-08-16 00:00:00,25,1582,1607
103-
3,Philip,Gent,Male,France,2015-05-21 00:00:00,36,2587,2623
104-
4,Kathleen,Hanner,Female,United States,2017-10-15 00:00:00,25,3549,3574
105-
5,Nereida,Magwood,Female,United States,2016-08-16 00:00:00,58,2468,2526
106-
6,Gaston,Brumm,Male,United States,2015-05-21 00:00:00,24,2554,2578
100+
1,Dulce,Abril,Female,United States,2017-10-15,32,1562,G2+H21594
101+
2,Mara,Hashimoto,Female,Great Britain,2016-08-16,25,1582,1607
102+
3,Philip,Gent,Male,France,2015-05-21,36,2587,2623
103+
4,Kathleen,Hanner,Female,United States,2017-10-15,25,3549,3574
104+
5,Nereida,Magwood,Female,United States,2016-08-16,58,2468,2526
105+
6,Gaston,Brumm,Male,United States,2015-05-21,24,2554,2578
107106
```
108107
<sup><a href='/src/Tests/Samples.VerifyExcel.verified.csv#L1-L7' title='Snippet source file'>snippet source</a> | <a href='#snippet-Samples.VerifyExcel.verified.csv' title='Start of snippet'>anchor</a></sup>
109108
<!-- endSnippet -->

src/Directory.Build.props

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
<Project>
33
<PropertyGroup>
44
<NoWarn>CS1591;CS0649;CA1416;NU1608;NU1109</NoWarn>
5-
<Version>0.4.0</Version>
5+
<Version>0.1.0-beta.1</Version>
66
<LangVersion>preview</LangVersion>
77
<AssemblyVersion>1.0.0</AssemblyVersion>
8-
<PackageTags>Sylvan.Data.Excel, Verify</PackageTags>
9-
<Description>Extends Verify (https://github.com/VerifyTests/Verify) to allow verification via Sylvan.Data.Excel https://github.com/MarkPflug/Sylvan.Data.Excel/</Description>
8+
<PackageTags>OpenXML, Verify</PackageTags>
9+
<Description>Extends Verify (https://github.com/VerifyTests/Verify) to allow verification via OpenXML https://github.com/dotnet/Open-XML-SDK</Description>
1010
<ResolveAssemblyReferencesSilent>true</ResolveAssemblyReferencesSilent>
1111
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1212
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
1313
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
14-
<SignAssembly>false</SignAssembly>
1514
</PropertyGroup>
1615
<ItemGroup>
1716
<Using Include="System.ReadOnlySpan&lt;System.Char&gt;" Alias="CharSpan" />

src/Tests/Samples.MultipleSheets.verified.txt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,55 @@
22
SheetNames: [
33
Sheet1,
44
Sheet2
5+
],
6+
CellFormats: [
7+
{
8+
FontId: 0,
9+
FillId: 0,
10+
BorderId: 0,
11+
NumberFormatId: 0: General,
12+
FormatId: 0
13+
},
14+
{
15+
FontId: 1,
16+
FillId: 0,
17+
BorderId: 0,
18+
NumberFormatId: 0: General,
19+
FormatId: 0,
20+
ApplyFont: 1
21+
},
22+
{
23+
FontId: 2,
24+
FillId: 0,
25+
BorderId: 0,
26+
NumberFormatId: 0: General,
27+
FormatId: 0,
28+
ApplyFont: 1
29+
},
30+
{
31+
FontId: 2,
32+
FillId: 0,
33+
BorderId: 0,
34+
NumberFormatId: 14: m/d/yyyy,
35+
FormatId: 0,
36+
ApplyNumberFormat: 1,
37+
ApplyFont: 1
38+
},
39+
{
40+
FontId: 0,
41+
FillId: 0,
42+
BorderId: 0,
43+
NumberFormatId: 14: m/d/yyyy,
44+
FormatId: 0,
45+
ApplyNumberFormat: 1
46+
},
47+
{
48+
FontId: 3,
49+
FillId: 0,
50+
BorderId: 0,
51+
NumberFormatId: 0: General,
52+
FormatId: 0,
53+
ApplyFont: 1
54+
}
555
]
656
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,47 @@
11
{
22
SheetNames: [
33
Sheet1
4+
],
5+
CellFormats: [
6+
{
7+
FontId: 0,
8+
FillId: 0,
9+
BorderId: 0,
10+
NumberFormatId: 0: General,
11+
FormatId: 0
12+
},
13+
{
14+
FontId: 1,
15+
FillId: 0,
16+
BorderId: 0,
17+
NumberFormatId: 0: General,
18+
FormatId: 0,
19+
ApplyFont: 1
20+
},
21+
{
22+
FontId: 2,
23+
FillId: 0,
24+
BorderId: 0,
25+
NumberFormatId: 0: General,
26+
FormatId: 0,
27+
ApplyFont: 1
28+
},
29+
{
30+
FontId: 2,
31+
FillId: 0,
32+
BorderId: 0,
33+
NumberFormatId: 14: m/d/yyyy,
34+
FormatId: 0,
35+
ApplyNumberFormat: 1,
36+
ApplyFont: 1
37+
},
38+
{
39+
FontId: 0,
40+
FillId: 0,
41+
BorderId: 0,
42+
NumberFormatId: 14: m/d/yyyy,
43+
FormatId: 0,
44+
ApplyNumberFormat: 1
45+
}
446
]
547
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,47 @@
11
{
22
SheetNames: [
33
Sheet1
4+
],
5+
CellFormats: [
6+
{
7+
FontId: 0,
8+
FillId: 0,
9+
BorderId: 0,
10+
NumberFormatId: 0: General,
11+
FormatId: 0
12+
},
13+
{
14+
FontId: 1,
15+
FillId: 0,
16+
BorderId: 0,
17+
NumberFormatId: 0: General,
18+
FormatId: 0,
19+
ApplyFont: 1
20+
},
21+
{
22+
FontId: 2,
23+
FillId: 0,
24+
BorderId: 0,
25+
NumberFormatId: 0: General,
26+
FormatId: 0,
27+
ApplyFont: 1
28+
},
29+
{
30+
FontId: 2,
31+
FillId: 0,
32+
BorderId: 0,
33+
NumberFormatId: 14: m/d/yyyy,
34+
FormatId: 0,
35+
ApplyNumberFormat: 1,
36+
ApplyFont: 1
37+
},
38+
{
39+
FontId: 0,
40+
FillId: 0,
41+
BorderId: 0,
42+
NumberFormatId: 14: m/d/yyyy,
43+
FormatId: 0,
44+
ApplyNumberFormat: 1
45+
}
446
]
547
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,47 @@
11
{
22
SheetNames: [
33
Sheet1
4+
],
5+
CellFormats: [
6+
{
7+
FontId: 0,
8+
FillId: 0,
9+
BorderId: 0,
10+
NumberFormatId: 0: General,
11+
FormatId: 0
12+
},
13+
{
14+
FontId: 1,
15+
FillId: 0,
16+
BorderId: 0,
17+
NumberFormatId: 0: General,
18+
FormatId: 0,
19+
ApplyFont: 1
20+
},
21+
{
22+
FontId: 2,
23+
FillId: 0,
24+
BorderId: 0,
25+
NumberFormatId: 0: General,
26+
FormatId: 0,
27+
ApplyFont: 1
28+
},
29+
{
30+
FontId: 2,
31+
FillId: 0,
32+
BorderId: 0,
33+
NumberFormatId: 14: m/d/yyyy,
34+
FormatId: 0,
35+
ApplyNumberFormat: 1,
36+
ApplyFont: 1
37+
},
38+
{
39+
FontId: 0,
40+
FillId: 0,
41+
BorderId: 0,
42+
NumberFormatId: 14: m/d/yyyy,
43+
FormatId: 0,
44+
ApplyNumberFormat: 1
45+
}
446
]
547
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
class CellFormatConverter :
2+
WriteOnlyJsonConverter<CellFormat>
3+
{
4+
public override void Write(VerifyJsonWriter writer, CellFormat options)
5+
{
6+
writer.WriteStartObject();
7+
writer.WriteMember(options, options.Alignment, "Alignment");
8+
writer.WriteMember(options, options.Protection, "Protection");
9+
writer.WriteMember(options, options.FontId, "FontId");
10+
writer.WriteMember(options, options.FillId, "FillId");
11+
writer.WriteMember(options, options.BorderId, "BorderId");
12+
13+
if (options.NumberFormatId != null)
14+
{
15+
var format = NumberFormatConverter.GetReadableFormat(options.NumberFormatId, VerifyOpenXml.CurrentDocument!.WorkbookPart!);
16+
writer.WriteMember(options, format, "NumberFormatId");
17+
}
18+
19+
writer.WriteMember(options, options.FormatId, "FormatId");
20+
writer.WriteMember(options, options.ApplyNumberFormat, "ApplyNumberFormat");
21+
writer.WriteMember(options, options.ApplyFont, "ApplyFont");
22+
writer.WriteMember(options, options.ApplyFill, "ApplyFill");
23+
writer.WriteMember(options, options.ApplyBorder, "ApplyBorder");
24+
writer.WriteMember(options, options.ApplyAlignment, "ApplyAlignment");
25+
writer.WriteMember(options, options.ApplyProtection, "ApplyProtection");
26+
writer.WriteMember(options, options.PivotButton, "PivotButton");
27+
writer.WriteMember(options, options.QuotePrefix, "QuotePrefix");
28+
writer.WriteEndObject();
29+
}
30+
}

src/Verify.OpenXml/Info.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class Info
22
{
3-
public required IEnumerable<string> SheetNames { get; init; }
3+
public required IReadOnlyList<string> SheetNames { get; init; }
4+
public required IReadOnlyList<CellFormat>? CellFormats { get; init; }
45
}

0 commit comments

Comments
 (0)