-
Notifications
You must be signed in to change notification settings - Fork 586
Expand file tree
/
Copy pathOpenXmlPartReaderOptions.cs
More file actions
56 lines (48 loc) · 2.02 KB
/
OpenXmlPartReaderOptions.cs
File metadata and controls
56 lines (48 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using DocumentFormat.OpenXml.Packaging;
namespace DocumentFormat.OpenXml;
/// <summary>
/// A collection of options for reading part information.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "This type should not be used for equality")]
public struct OpenXmlPartReaderOptions
{
/// <summary>
/// Gets or sets a value indicating whether miscellaneous nodes are read.
/// </summary>
public bool ReadMiscellaneousNodes { get; set; }
/// <summary>
/// Gets or sets the maximum characters allowed in a part.
/// </summary>
public long MaxCharactersInPart { get; set; }
/// <summary>
/// Gets or sets a value indicating whether whitespace will be ignored.
/// </summary>
public bool IgnoreWhitespace { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the stream should be closed on the part reader being closed.
/// </summary>
public bool CloseStream { get; set; }
#if TASKS_SUPPORTED
/// <summary>
/// Gets or sets a value indicating whether the part reader should operate asynchronously.
/// </summary>
/// <remarks>
/// When set to <c>true</c>, the reader will use asynchronous methods for reading XML data,
/// allowing non-blocking operations. This property is only available when the build target
/// supports asynchronous SAX XML processing.
/// </remarks>
public bool Async { get; set; }
#endif
internal OpenXmlPartReaderOptions UpdateForPart(OpenXmlPart part) => new()
{
ReadMiscellaneousNodes = ReadMiscellaneousNodes,
MaxCharactersInPart = MaxCharactersInPart != 0 ? MaxCharactersInPart : part.MaxCharactersInPart,
IgnoreWhitespace = IgnoreWhitespace,
CloseStream = true,
#if TASKS_SUPPORTED
Async = Async,
#endif
};
}