mirror of
https://gitee.com/dotnetchina/MiniExcel.git
synced 2024-11-29 18:38:08 +08:00
支持Strict Open Xml
This commit is contained in:
parent
25f5811888
commit
f0bce37e82
Binary file not shown.
@ -4,5 +4,7 @@
|
||||
{
|
||||
public const string SpreadsheetmlXmlns = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
|
||||
public const string SpreadsheetmlXmlStrictns = "http://purl.oclc.org/ooxml/spreadsheetml/main";
|
||||
public const string SpreadsheetmlXmlRelationshipns = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
||||
public const string SpreadsheetmlXmlStrictRelationshipns = "http://purl.oclc.org/ooxml/officeDocument/relationships";
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ namespace MiniExcelLibs.OpenXml
|
||||
internal class ExcelOpenXmlSheetReader : IExcelReader
|
||||
{
|
||||
private static readonly string[] _ns = { Config.SpreadsheetmlXmlns, Config.SpreadsheetmlXmlStrictns };
|
||||
private static readonly string[] _relationshiopNs = { Config.SpreadsheetmlXmlRelationshipns, Config.SpreadsheetmlXmlStrictRelationshipns };
|
||||
private List<SheetRecord> _sheetRecords;
|
||||
private List<string> _sharedStrings;
|
||||
private MergeCells _mergeCells;
|
||||
@ -529,7 +530,7 @@ namespace MiniExcelLibs.OpenXml
|
||||
yield return new SheetRecord(
|
||||
reader.GetAttribute("name"),
|
||||
uint.Parse(reader.GetAttribute("sheetId")),
|
||||
reader.GetAttribute("id", "http://schemas.openxmlformats.org/officeDocument/2006/relationships")
|
||||
GetAttribute(reader, "id", _relationshiopNs)
|
||||
);
|
||||
reader.Skip();
|
||||
}
|
||||
@ -730,5 +731,19 @@ namespace MiniExcelLibs.OpenXml
|
||||
{
|
||||
return nss.Any(s => reader.IsStartElement(name, s));
|
||||
}
|
||||
|
||||
private string GetAttribute(XmlReader reader, string name, params string[] nss)
|
||||
{
|
||||
foreach (var ns in nss)
|
||||
{
|
||||
var attribute = reader.GetAttribute(name, ns);
|
||||
if (attribute != null)
|
||||
{
|
||||
return attribute;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user