Skip to content

Add FileFormatVersions.Office2019 for completeness #695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 24, 2020
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
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

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

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

## Version 2.10.1 - 2020-02-28
### Fixed
- Ensures attributes are available when `OpenXmlElement` is initialized with outer XML (#684, #692)
- Ensured attributes are available when `OpenXmlElement` is initialized with outer XML (#684, #692)
- Some documentation errors (#681)
- Removed state that made it non-thread safe to validate elements under certain conditions (#686)
- Correctly inserts strongly-typed elements before known elements that are not strongly-typed (#690)
Expand All @@ -24,7 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Added initial Office 2016 support, including `FileFormatVersion.Office2016`, `ExtendedChartPart` and other new schema elements (#586)
- Added .NET Standard 2.0 target (#587)
- Include symbols support for debugging (#650)
- Included symbols support for debugging (#650)
- Exposed `IXmlNamespaceResolver` from `XmlPath` instead of formatted list of strings to expose namespace/prefix mapping (#536)
- Implemented `IComparable<T>` and `IEquatable<T>` on `OpenXmlComparableSimpleValue` to allow comparisons without boxing (#550)
- Added `OpenXmlPackage.RootPart` to easily access the root part on any package (#661)
Expand Down
26 changes: 20 additions & 6 deletions src/DocumentFormat.OpenXml/FileFormatVersionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ internal static class FileFormatVersionExtensions
FileFormatVersions.Office2010,
FileFormatVersions.Office2013,
FileFormatVersions.Office2016,
FileFormatVersions.Office2019,
};

/// <summary>
Expand All @@ -26,7 +27,8 @@ public static bool Any(this FileFormatVersions version)
return version == FileFormatVersions.Office2007
|| version == FileFormatVersions.Office2010
|| version == FileFormatVersions.Office2013
|| version == FileFormatVersions.Office2016;
|| version == FileFormatVersions.Office2016
|| version == FileFormatVersions.Office2019;
}

/// <summary>
Expand All @@ -40,7 +42,8 @@ public static bool All(this FileFormatVersions version)
FileFormatVersions.Office2007
| FileFormatVersions.Office2010
| FileFormatVersions.Office2013
| FileFormatVersions.Office2016;
| FileFormatVersions.Office2016
| FileFormatVersions.Office2019;

return version == AllVersions;
}
Expand All @@ -58,16 +61,22 @@ public static FileFormatVersions AndLater(this FileFormatVersions version)
return FileFormatVersions.Office2007
| FileFormatVersions.Office2010
| FileFormatVersions.Office2013
| FileFormatVersions.Office2016;
| FileFormatVersions.Office2016
| FileFormatVersions.Office2019;
case FileFormatVersions.Office2010:
return FileFormatVersions.Office2010
| FileFormatVersions.Office2013
| FileFormatVersions.Office2016;
| FileFormatVersions.Office2016
| FileFormatVersions.Office2019;
case FileFormatVersions.Office2013:
return FileFormatVersions.Office2013
| FileFormatVersions.Office2016;
| FileFormatVersions.Office2016
| FileFormatVersions.Office2019;
case FileFormatVersions.Office2016:
return FileFormatVersions.Office2016;
return FileFormatVersions.Office2016
| FileFormatVersions.Office2019;
case FileFormatVersions.Office2019:
return FileFormatVersions.Office2019;
default:
throw new ArgumentOutOfRangeException(nameof(version));
}
Expand Down Expand Up @@ -138,6 +147,11 @@ int MapToInteger(FileFormatVersions v, string name)
return 4;
}

if ((FileFormatVersions.Office2019 & v) == FileFormatVersions.Office2019)
{
return 5;
}

throw new ArgumentOutOfRangeException(name);
}

Expand Down
5 changes: 5 additions & 0 deletions src/DocumentFormat.OpenXml/FileFormatVersions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,10 @@ public enum FileFormatVersions
/// Represents Microsoft Office 2016.
/// </summary>
Office2016 = 0x8,

/// <summary>
/// Represents Microsoft Office 2016.
/// </summary>
Office2019 = 0x10,
}
}
Loading