11using NanoXLSX.Interfaces.Plugin;
13using NanoXLSX.Registry;
14using NanoXLSX.Registry.Attributes;
16using IOException =
NanoXLSX.Exceptions.IOException;
24 [NanoXlsxPlugIn(PlugInUUID = PlugInUUID.RelationshipReader)]
28 private MemoryStream stream;
55 public void Init(MemoryStream stream,
Workbook workbook, IOptions readerOptions)
58 this.workbook = workbook;
67 if (stream ==
null)
return;
77 using (XmlReader reader = XmlReader.Create(stream,
new XmlReaderSettings() { XmlResolver =
null }))
80 XmlNodeList relationships = xr.GetElementsByTagName(
"Relationship");
81 foreach (XmlNode relationship
in relationships)
86 if (ParserUtils.StartsWith(target,
"/"))
88 target = target.TrimStart(
'/');
90 if (ParserUtils.NotStartsWith(target,
"xl/"))
92 target =
"xl/" + target;
100 Workbook.AuxiliaryData.SetData(PlugInUUID.RelationshipReader, PlugInUUID.RelationshipEntity,
id, rel);
102 RederPlugInHandler.HandleInlineQueuePlugins(ref stream,
Workbook, PlugInUUID.RelationshipInlineReader);
108 throw new IOException(
"The XML entry could not be read from the input stream. Please see the inner exception:", ex);
Static class with common util methods, used during reading XLSX files.
static string GetAttribute(XmlNode node, string targetName, string fallbackValue=null)
Gets the XML attribute of the passed XML node by its name.
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).
Workbook Workbook
Workbook reference where read data is stored (should not be null).
void Init(MemoryStream stream, Workbook workbook, IOptions readerOptions)
Initialization method (interface implementation).
Class to represent a workbook relation.
Exceptions.IOException IOException