Skip to content

Commit 4d987dc

Browse files
authored
Add FileFormatVersions.Office2019 for completeness (#695)
1 parent 0e65060 commit 4d987dc

File tree

5 files changed

+1873
-1838
lines changed

5 files changed

+1873
-1838
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## Version 2.11.0 - Unreleased
88
### Added
9+
- Added `FileFormatVersions.2019` enum (#695)
10+
- Added `OpenXmlElementFunctionalExtensions.With(...)` extension methods, which offer flexible means for constructing `OpenXmlElement` instances in the context of pure functional transformations (#679)
911
- Added minimum Office versions for enum types and values (#707).
10-
- Added `OpenXmlElementFunctionalExtensions.With` extension methods, which offer flexible means for constructing `OpenXmlElement` instances in the context of pure functional transformations.
1112
- Added additional `CompatSettingNameValues` values: `UseWord2013TrackBottomHyphenation`, `AllowHyphenationAtTrackBottom`, and `AllowTextAfterFloatingTableBreak` (#706).
1213

1314
### Changes
1415
- Marked the property setters in `OpenXmlAttribute` as obsolete as structs should not have mutable state (#698)
1516

1617
## Version 2.10.1 - 2020-02-28
1718
### Fixed
18-
- Ensures attributes are available when `OpenXmlElement` is initialized with outer XML (#684, #692)
19+
- Ensured attributes are available when `OpenXmlElement` is initialized with outer XML (#684, #692)
1920
- Some documentation errors (#681)
2021
- Removed state that made it non-thread safe to validate elements under certain conditions (#686)
2122
- Correctly inserts strongly-typed elements before known elements that are not strongly-typed (#690)
@@ -24,7 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2425
### Added
2526
- Added initial Office 2016 support, including `FileFormatVersion.Office2016`, `ExtendedChartPart` and other new schema elements (#586)
2627
- Added .NET Standard 2.0 target (#587)
27-
- Include symbols support for debugging (#650)
28+
- Included symbols support for debugging (#650)
2829
- Exposed `IXmlNamespaceResolver` from `XmlPath` instead of formatted list of strings to expose namespace/prefix mapping (#536)
2930
- Implemented `IComparable<T>` and `IEquatable<T>` on `OpenXmlComparableSimpleValue` to allow comparisons without boxing (#550)
3031
- Added `OpenXmlPackage.RootPart` to easily access the root part on any package (#661)

src/DocumentFormat.OpenXml/FileFormatVersionExtensions.cs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ internal static class FileFormatVersionExtensions
1414
FileFormatVersions.Office2010,
1515
FileFormatVersions.Office2013,
1616
FileFormatVersions.Office2016,
17+
FileFormatVersions.Office2019,
1718
};
1819

1920
/// <summary>
@@ -26,7 +27,8 @@ public static bool Any(this FileFormatVersions version)
2627
return version == FileFormatVersions.Office2007
2728
|| version == FileFormatVersions.Office2010
2829
|| version == FileFormatVersions.Office2013
29-
|| version == FileFormatVersions.Office2016;
30+
|| version == FileFormatVersions.Office2016
31+
|| version == FileFormatVersions.Office2019;
3032
}
3133

3234
/// <summary>
@@ -40,7 +42,8 @@ public static bool All(this FileFormatVersions version)
4042
FileFormatVersions.Office2007
4143
| FileFormatVersions.Office2010
4244
| FileFormatVersions.Office2013
43-
| FileFormatVersions.Office2016;
45+
| FileFormatVersions.Office2016
46+
| FileFormatVersions.Office2019;
4447

4548
return version == AllVersions;
4649
}
@@ -58,16 +61,22 @@ public static FileFormatVersions AndLater(this FileFormatVersions version)
5861
return FileFormatVersions.Office2007
5962
| FileFormatVersions.Office2010
6063
| FileFormatVersions.Office2013
61-
| FileFormatVersions.Office2016;
64+
| FileFormatVersions.Office2016
65+
| FileFormatVersions.Office2019;
6266
case FileFormatVersions.Office2010:
6367
return FileFormatVersions.Office2010
6468
| FileFormatVersions.Office2013
65-
| FileFormatVersions.Office2016;
69+
| FileFormatVersions.Office2016
70+
| FileFormatVersions.Office2019;
6671
case FileFormatVersions.Office2013:
6772
return FileFormatVersions.Office2013
68-
| FileFormatVersions.Office2016;
73+
| FileFormatVersions.Office2016
74+
| FileFormatVersions.Office2019;
6975
case FileFormatVersions.Office2016:
70-
return FileFormatVersions.Office2016;
76+
return FileFormatVersions.Office2016
77+
| FileFormatVersions.Office2019;
78+
case FileFormatVersions.Office2019:
79+
return FileFormatVersions.Office2019;
7180
default:
7281
throw new ArgumentOutOfRangeException(nameof(version));
7382
}
@@ -138,6 +147,11 @@ int MapToInteger(FileFormatVersions v, string name)
138147
return 4;
139148
}
140149

150+
if ((FileFormatVersions.Office2019 & v) == FileFormatVersions.Office2019)
151+
{
152+
return 5;
153+
}
154+
141155
throw new ArgumentOutOfRangeException(name);
142156
}
143157

src/DocumentFormat.OpenXml/FileFormatVersions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,10 @@ public enum FileFormatVersions
3535
/// Represents Microsoft Office 2016.
3636
/// </summary>
3737
Office2016 = 0x8,
38+
39+
/// <summary>
40+
/// Represents Microsoft Office 2016.
41+
/// </summary>
42+
Office2019 = 0x10,
3843
}
3944
}

0 commit comments

Comments
 (0)