11using NanoXLSX.Interfaces;
12using NanoXLSX.Interfaces.Reader;
13using NanoXLSX.Registry;
14using NanoXLSX.Registry.Attributes;
16using NanoXLSX.Utils.Xml;
17using IOException =
NanoXLSX.Exceptions.IOException;
25 [NanoXlsxPlugIn(PlugInUUID = PlugInUUID.RelationshipReader)]
28 private Stream stream;
64 public void Init(Stream stream,
Workbook workbook, IOptions readerOptions, Action<Stream, Workbook, string, IOptions, int?> inlinePluginHandler)
67 this.Workbook = workbook;
68 this.Options = readerOptions;
69 this.InlinePluginHandler = inlinePluginHandler;
78 if (stream ==
null)
return;
83 using (XmlReader reader = XmlReader.Create(stream, XmlStreamUtils.CreateSettings()))
87 if (!XmlStreamUtils.IsElement(reader,
"Relationship"))
91 string id = reader.GetAttribute(
"Id");
92 string type = reader.GetAttribute(
"Type");
93 string target = reader.GetAttribute(
"Target");
94 if (ParserUtils.StartsWith(target,
"/"))
96 target = target.TrimStart(
'/');
98 if (ParserUtils.NotStartsWith(target,
"xl/"))
100 target =
"xl/" + target;
108 Workbook.AuxiliaryData.SetData(PlugInUUID.RelationshipReader, PlugInUUID.RelationshipEntity,
id, rel);
116 throw new IOException(
"The XML entry could not be read from the input stream. Please see the inner exception:", ex);
RelationshipReader()
Default constructor - Must be defined for instantiation of the plug-ins.
void Execute()
Method to execute the main logic of the plug-in (interface implementation).
IOptions Options
Reader options.
Action< Stream, Workbook, string, IOptions, int?> InlinePluginHandler
Reference to the ReaderPlugInHandler, to be used for post operations in the Execute method.
void Init(Stream stream, Workbook workbook, IOptions readerOptions, Action< Stream, Workbook, string, IOptions, int?> inlinePluginHandler)
Initialization method (interface implementation).
Workbook Workbook
Workbook reference where read data is stored (should not be null).
Class to represent a workbook relation.
Exceptions.IOException IOException