Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 815eb29
Merge: efb45c5 ff7fa87
Author: Tony Qu <tonyqus@gmail.com>
Date:   Fri Apr 26 22:37:31 2024 +0800

    Merge pull request nissl-lab#1316 from antony-liu/poi/v3.16-patch3

    Some patches ported from poi

commit efb45c5
Merge: 5cb561d b48fe66
Author: Tony Qu <tonyqus@gmail.com>
Date:   Fri Apr 26 21:51:49 2024 +0800

    Merge pull request nissl-lab#1284 from superrnovae/bmp_pictures

    Opening existing workbook with pictures, adding new ones and saving it should not throw an exception

commit ff7fa87
Merge: cc1de9a 5cb561d
Author: Antony Liu <sun_apollo@yeah.net>
Date:   Fri Apr 26 20:59:25 2024 +0800

    Merge branch 'master' into poi/v3.16-patch3

commit 5cb561d
Merge: e82fa27 c0378c6
Author: Tony Qu <tonyqus@gmail.com>
Date:   Thu Apr 25 02:05:43 2024 +0800

    Merge pull request nissl-lab#1303 from Bykiev/FixCreateCellComment

    XLS - Fix adding cell comment

commit e82fa27
Merge: 83106c2 989cb6b
Author: Tony Qu <tonyqus@gmail.com>
Date:   Wed Apr 24 19:43:02 2024 +0800

    Merge branch 'master' of https://github.com/nissl-lab/npoi

commit 83106c2
Author: Tony Qu <tonyqus@gmail.com>
Date:   Wed Apr 24 19:42:35 2024 +0800

    fix nissl-lab#1315 - rollback the change of dt2D and dtr property

commit 989cb6b
Merge: 7fd6e4c 9fe58ed
Author: Tony Qu <tonyqus@gmail.com>
Date:   Wed Apr 24 04:19:14 2024 +0800

    Merge pull request nissl-lab#1281 from superrnovae/xssf_formula_results_format

    [Bug 67785] Make XSSFExcelExtractor output more like that from XSSFEventBasedExcelExtractor

commit 7fd6e4c
Merge: 976c1f5 7892c92
Author: Tony Qu <tonyqus@gmail.com>
Date:   Wed Apr 24 03:58:13 2024 +0800

    Merge pull request nissl-lab#1307 from Bykiev/DocVars

    Fix reading document variables

commit 976c1f5
Merge: 3412b21 428a170
Author: Tony Qu <tonyqus@gmail.com>
Date:   Wed Apr 24 03:55:07 2024 +0800

    Merge pull request nissl-lab#1262 from jake-codes-at-5-am/removedatavalidation-to-upstream

    Add RemoveDataValidation method

commit 3412b21
Merge: 4eb5d0e 7c65a61
Author: Tony Qu <tonyqus@gmail.com>
Date:   Wed Apr 24 03:53:27 2024 +0800

    Merge pull request nissl-lab#1314 from antony-liu/fix/github-issue-1070

    Avoid NullReference exception when saving workbook with XML Map

commit 4eb5d0e
Merge: 9e6eef1 44de724
Author: Tony Qu <tonyqus@gmail.com>
Date:   Thu Apr 18 08:13:11 2024 +0800

    Merge pull request nissl-lab#1317 from DontFretBrett/update-sixlabors-imagesharp-218

    Update SixLabors.ImageSharp to 2.1.8. CVE-2024-32036

commit 44de724
Author: Brett Sanders <brett.sanders@lightstream.com>
Date:   Wed Apr 17 10:53:37 2024 -0700

    Update SixLabors.ImageSharp to 2.1.8. CVE-2024-32036

commit 9e6eef1
Merge: 595ed45 6321d89
Author: Tony Qu <tonyqus@gmail.com>
Date:   Tue Apr 16 22:31:48 2024 +0800

    Merge branch 'master' of https://github.com/nissl-lab/npoi

commit 595ed45
Author: Tony Qu <tonyqus@gmail.com>
Date:   Tue Apr 16 22:31:38 2024 +0800

    fix TestXWPFRun unit test

commit 6321d89
Merge: a8a827f 1067d7f
Author: Tony Qu <tonyqus@gmail.com>
Date:   Tue Apr 16 09:05:17 2024 +0800

    Merge pull request nissl-lab#1313 from Bykiev/SharpZipLib

    Update SharpZipLib to v1.4.2

commit a8a827f
Merge: f0b0ea8 79dfd75
Author: Tony Qu <tonyqus@gmail.com>
Date:   Tue Apr 16 09:04:05 2024 +0800

    Merge pull request nissl-lab#1283 from superrnovae/table_cellreferences

    [github-164] Fix Bug in XSSFTable.setCellReferences when table is single cell.

commit f0b0ea8
Merge: 174fc67 16b283d
Author: Tony Qu <tonyqus@gmail.com>
Date:   Tue Apr 16 09:02:16 2024 +0800

    Merge pull request nissl-lab#1309 from antony-liu/poi/v3.16-patch2

    Patches about VBAMacroReader from poi

commit 174fc67
Merge: d31d5d3 649c565
Author: Tony Qu <tonyqus@gmail.com>
Date:   Tue Apr 16 08:47:24 2024 +0800

    Merge branch 'master' of https://github.com/nissl-lab/npoi

commit d31d5d3
Author: Tony Qu <tonyqus@gmail.com>
Date:   Tue Apr 16 08:46:58 2024 +0800

    adjust Word openxml serialization

commit 990e862
Author: Tony Qu <tonyqus@gmail.com>
Date:   Tue Apr 16 08:45:20 2024 +0800

    only add xml:space="preserve" when the value starts or ends with whitespace

commit 590b7f7
Author: Tony Qu <tonyqus@gmail.com>
Date:   Tue Apr 16 08:42:58 2024 +0800

    fix nissl-lab#1276 - remove docGrid init code in CT_SectPr constructor

commit 7c65a61
Author: Antony Liu <sun_apollo@yeah.net>
Date:   Sat Apr 13 15:30:16 2024 +0800

    Fix issue nissl-lab#1070, avoid NullReference exception when saving workbook with XML Map

commit 1067d7f
Author: ABykiev <bykiev.andrei@mail.ru>
Date:   Tue Apr 9 18:51:36 2024 +0300

    Update SharpZipLib to v1.4.2

    Closes nissl-lab#1149

commit 16b283d
Merge: 8f43183 649c565
Author: Antony Liu <sun_apollo@yeah.net>
Date:   Fri Apr 5 09:58:46 2024 +0800

    Merge branch 'master' into poi/v3.16-patch2

commit 649c565
Merge: 17041e5 7c89ee6
Author: Tony Qu <tonyqus@gmail.com>
Date:   Fri Apr 5 09:22:04 2024 +0800

    Merge pull request nissl-lab#1306 from antony-liu/poi/v3.16-patch1

    Some patches ported from poi

commit 17041e5
Merge: 462f15f b89af43
Author: Tony Qu <tonyqus@gmail.com>
Date:   Wed Apr 3 07:35:01 2024 +0800

    Merge pull request nissl-lab#1291 from jake-codes-at-5-am/fix-ct-formulacell-write

    CT_CellFormula.Write: fix writing the si attribute

commit 7892c92
Author: ABykiev <bykiev.andrei@mail.ru>
Date:   Tue Apr 2 21:58:45 2024 +0300

    Fix reading document variables

    Closes nissl-lab#1199

commit c0378c6
Author: ABykiev <bykiev.andrei@mail.ru>
Date:   Sun Mar 31 20:31:09 2024 +0300

    XLS - Fix adding cell comment

    Closes nissl-lab#1240

commit 462f15f
Author: Tony Qu <tonyqus@gmail.com>
Date:   Thu Mar 28 11:09:26 2024 +0800

    Update FUNDING.yml

commit 766e2c5
Author: Tony Qu <tonyqus@gmail.com>
Date:   Thu Mar 28 11:07:55 2024 +0800

    Create FUNDING.yml

commit 844391f
Author: Tony Qu <772561+tonyqus@users.noreply.github.com>
Date:   Thu Mar 28 11:00:17 2024 +0800

    Delete .github/FUNDING.yml

commit b89af43
Author: Artem Koloskov <artem@ironsoftware.com>
Date:   Tue Mar 12 15:27:58 2024 +0700

    upstream-fix: in `CT_CellFormula` ensure the `siField` is written into `fField`'s attributes on `Write` even when it has a default value for cases when the type of the formula is Shared formula.

commit b48fe66
Author: suppernovae <vladislavp@pm.me>
Date:   Tue Mar 5 13:08:05 2024 +0100

    Fix saving existing workbook with pictures after adding new ones

commit 79dfd75
Author: suppernovae <vladislavp@pm.me>
Date:   Tue Mar 5 11:43:26 2024 +0100

    [github-164] Fix Bug in XSSFTable.setCellReferences when table is single cell

commit 9fe58ed
Author: suppernovae <vladislavp@pm.me>
Date:   Tue Mar 5 10:48:34 2024 +0100

    Revert "Use range operator instead of substring method"

    This reverts commit 5b838ba.

commit 5b838ba
Author: suppernovae <vladislavp@pm.me>
Date:   Tue Mar 5 10:41:42 2024 +0100

    Use range operator instead of substring method

commit e5e92af
Author: suppernovae <vladislavp@pm.me>
Date:   Mon Mar 4 23:36:35 2024 +0100

    Bug 67784: XSSFExcelExtractor does not format formula results like the streaming based extractor

commit 428a170
Author: Artem Koloskov <artem@ironsoftware.com>
Date:   Fri Feb 9 11:31:06 2024 +0700

    Upstream feature: change RemoveValidationData methods to RemoveDataValidation

commit a39833e
Author: Artem Koloskov <artem@ironsoftware.com>
Date:   Tue Nov 28 16:45:29 2023 +0700

    Upstream feature: add tests for ISheet.RemoveValidationData method

commit fefe574
Author: Artem Koloskov <artem@ironsoftware.com>
Date:   Tue Nov 28 16:44:37 2023 +0700

    Upstream fix: fix CT_DataValidations.Write method.

    It was writing an empty dataValidations node if its dataValidation property was empty, which was breaking the resulting xlsx file

commit 8e4b633
Author: Artem Koloskov <artem@ironsoftware.com>
Date:   Tue Nov 28 16:41:54 2023 +0700

    Upstream feature: ass ISheet.RemoveValidationData method and implement it in HSSF, XSSF and SXSSF Sheets

commit 73daa01
Author: Artem Koloskov <artem@ironsoftware.com>
Date:   Tue Nov 28 16:40:21 2023 +0700

    Upstream feature: implement DataValidityTable.RemoveDataValidation method

commit 01c9fa5
Author: Artem Koloskov <artem@ironsoftware.com>
Date:   Tue Nov 28 16:38:03 2023 +0700

    Upstream feature: Implement CT_DataValidation and DVRecord Equals() method overrides.
  • Loading branch information
antony-liu committed Apr 26, 2024
1 parent 1212e24 commit 2015bb7
Show file tree
Hide file tree
Showing 41 changed files with 1,060 additions and 531 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
custom: ["https://www.paypal.me/tonyqus"]
github: nissl-lab
8 changes: 4 additions & 4 deletions OpenXmlFormats/Drawing/WordprocessingDrawing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,10 @@ public static CT_Inline Parse(XmlNode node, XmlNamespaceManager namespaceManager
if (node == null)
return null;
CT_Inline ctObj = new CT_Inline();
ctObj.distT = XmlHelper.ReadUInt(node.Attributes["wp:distT"]);
ctObj.distB = XmlHelper.ReadUInt(node.Attributes["wp:distB"]);
ctObj.distL = XmlHelper.ReadUInt(node.Attributes["wp:distL"]);
ctObj.distR = XmlHelper.ReadUInt(node.Attributes["wp:distR"]);
ctObj.distT = XmlHelper.ReadUInt(node.Attributes["distT"]);
ctObj.distB = XmlHelper.ReadUInt(node.Attributes["distB"]);
ctObj.distL = XmlHelper.ReadUInt(node.Attributes["distL"]);
ctObj.distR = XmlHelper.ReadUInt(node.Attributes["distR"]);
foreach (XmlNode childNode in node.ChildNodes)
{
if (childNode.LocalName == "extent")
Expand Down
147 changes: 146 additions & 1 deletion OpenXmlFormats/Spreadsheet/CustomXmlMappings.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using NPOI.OpenXml4Net.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Xml;
using System.Xml.Serialization;

Expand All @@ -23,6 +25,40 @@ public class CT_MapInfo

private string selectionNamespacesField = string.Empty; // 1..1

public static CT_MapInfo Parse(XmlNode node, XmlNamespaceManager namespaceManager)
{
CT_MapInfo ctObj = new CT_MapInfo();
ctObj.SelectionNamespaces = XmlHelper.ReadString(node.Attributes["SelectionNamespaces"]);
foreach(XmlNode cn in node.ChildNodes)
{
if(cn.LocalName == "Schema")
{
ctObj.Schema.Add(CT_Schema.Parse(cn, namespaceManager));
}
else if(cn.LocalName == "Map")
{
ctObj.Map.Add(CT_Map.Parse(cn, namespaceManager));
}
}
return ctObj;
}

internal void Write(StreamWriter sw, string nodeName)
{
sw.Write(string.Format("<{0}", nodeName));
XmlHelper.WriteAttribute(sw, "SelectionNamespaces", this.SelectionNamespaces);
sw.Write(">");
foreach(CT_Schema ctSchema in Schema)
{
ctSchema.Write(sw, "Schema");
}

foreach(CT_Map ctMap in Map)
{
ctMap.Write(sw, "Map");
}
sw.Write(string.Format("</{0}>", nodeName));
}
[XmlElement("Schema")]
public List<CT_Schema> Schema
{
Expand Down Expand Up @@ -77,6 +113,30 @@ public class CT_Schema

private string namespaceField = null; // 0..1

private string schemaLanguageField;

public static CT_Schema Parse(XmlNode node, XmlNamespaceManager namespaceManager)
{
CT_Schema ctObj = new CT_Schema();
ctObj.ID = node.Attributes["ID"].Value;
ctObj.Namespace = XmlHelper.ReadString(node.Attributes["Namespace"]);
ctObj.SchemaRef = XmlHelper.ReadString(node.Attributes["SchemaRef"]);
ctObj.SchemaLanguage = XmlHelper.ReadString(node.Attributes["SchemaLanguage"]);
ctObj.Any = node.FirstChild as XmlElement;
return ctObj;
}
internal void Write(StreamWriter sw, string nodeName)
{
sw.Write(string.Format("<{0}", nodeName));
XmlHelper.WriteAttribute(sw, "ID", this.ID);
XmlHelper.WriteAttribute(sw, "Namespace", this.Namespace);
XmlHelper.WriteAttribute(sw, "SchemaRef", this.SchemaRef);
XmlHelper.WriteAttribute(sw, "SchemaLanguage", this.SchemaLanguage);
sw.Write(">");
if(anyField != null)
sw.Write(anyField.OuterXml);
sw.Write(string.Format("</{0}>", nodeName));
}
[XmlAnyElement]
public System.Xml.XmlElement Any
{
Expand Down Expand Up @@ -144,7 +204,23 @@ public bool NamespaceSpecified
get { return null != this.namespaceField; }
}

public string InnerXml;
public string SchemaLanguage
{
get
{
return this.schemaLanguageField;
}
set
{
schemaLanguageField = value;
}
}

[XmlIgnore]
public bool SchemaLanguageSpecified
{
get { return null != this.schemaLanguageField; }
}
}


Expand Down Expand Up @@ -176,6 +252,49 @@ public class CT_Map

private bool preserveFormatField;

public static CT_Map Parse(XmlNode node, XmlNamespaceManager namespaceManager)
{
CT_Map ctMap = new CT_Map();
ctMap.ID = XmlHelper.ReadUInt(node.Attributes["ID"]);
ctMap.Name = XmlHelper.ReadString(node.Attributes["Name"]);
ctMap.RootElement = XmlHelper.ReadString(node.Attributes["RootElement"]);
ctMap.SchemaID = XmlHelper.ReadString(node.Attributes["SchemaID"]);
ctMap.ShowImportExportValidationErrors = XmlHelper.ReadBool(node.Attributes["ShowImportExportValidationErrors"]);
ctMap.PreserveFormat = XmlHelper.ReadBool(node.Attributes["PreserveFormat"]);
ctMap.PreserveSortAFLayout = XmlHelper.ReadBool(node.Attributes["PreserveSortAFLayout"]);
ctMap.Append = XmlHelper.ReadBool(node.Attributes["Append"]);
ctMap.AutoFit = XmlHelper.ReadBool(node.Attributes["AutoFit"]);
foreach(XmlElement ele in node)
{
if(ele.LocalName == "DataBinding")
{
ctMap.DataBinding = CT_DataBinding.Parse(ele, namespaceManager);
}
}
return ctMap;
}
internal void Write(StreamWriter sw, string nodeName)
{
sw.Write(string.Format("<{0}", nodeName));
XmlHelper.WriteAttribute(sw, "ID", this.ID);
XmlHelper.WriteAttribute(sw, "Name", this.Name);
XmlHelper.WriteAttribute(sw, "RootElement", this.RootElement);
XmlHelper.WriteAttribute(sw, "SchemaID", this.SchemaID);
XmlHelper.WriteAttribute(sw, "ShowImportExportValidationErrors", this.ShowImportExportValidationErrors);
XmlHelper.WriteAttribute(sw, "PreserveFormat", this.PreserveFormat);
XmlHelper.WriteAttribute(sw, "PreserveSortAFLayout", this.PreserveSortAFLayout);
XmlHelper.WriteAttribute(sw, "Append", this.Append);
XmlHelper.WriteAttribute(sw, "AutoFit", this.AutoFit);

if(dataBindingField != null)
{
sw.Write(">");
dataBindingField.Write(sw, "DataBinding");
sw.Write(string.Format("</{0}>", nodeName));
}
else
sw.Write("/>");
}
[XmlElement]
public CT_DataBinding DataBinding
{
Expand Down Expand Up @@ -343,7 +462,33 @@ public partial class CT_DataBinding

private uint dataBindingLoadModeField = 0; // 1..1 - default value not defined in xsd

public static CT_DataBinding Parse(XmlNode ele, XmlNamespaceManager namespaceManager)
{
CT_DataBinding ctObj = new CT_DataBinding();
ctObj.Any = ele.FirstChild as XmlElement;
ctObj.connectionIDField = ele.Attributes["ConnectionID"] ==null ? null : XmlHelper.ReadUInt(ele.Attributes["ConnectionID"]);
ctObj.DataBindingName = XmlHelper.ReadString(ele.Attributes["DataBindingName"]);
ctObj.FileBindingName = XmlHelper.ReadString(ele.Attributes["FileBindingName"]);
ctObj.DataBindingLoadMode = XmlHelper.ReadUInt(ele.Attributes["DataBindingLoadMode"]);
ctObj.fileBindingField = ele.Attributes["FileBinding"] ==null ? null : XmlHelper.ReadBool(ele.Attributes["FileBinding"]);
return ctObj;
}

internal void Write(StreamWriter sw, string nodeName)
{
sw.Write(string.Format("<{0}", nodeName));
if(this.FileBindingSpecified)
XmlHelper.WriteAttribute(sw, "FileBinding", FileBinding);
if(this.ConnectionIDSpecified)
XmlHelper.WriteAttribute(sw, "ConnectionID", ConnectionID);
XmlHelper.WriteAttribute(sw, "DataBindingLoadMode", DataBindingLoadMode);
XmlHelper.WriteAttribute(sw, "DataBindingName", DataBindingName);
XmlHelper.WriteAttribute(sw, "FileBindingName", FileBindingName);
sw.Write(">");
if(anyField != null)
sw.Write(anyField.OuterXml);
sw.Write(string.Format("</{0}>", nodeName));
}
[XmlAnyElement]
public System.Xml.XmlElement Any
{
Expand Down
83 changes: 9 additions & 74 deletions OpenXmlFormats/Spreadsheet/Document/MapInfoDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,105 +7,40 @@ namespace NPOI.OpenXmlFormats.Spreadsheet
{
public class MapInfoDocument
{
CT_MapInfo map = null;
CT_MapInfo mapInfo = null;

public MapInfoDocument()
{
}
public MapInfoDocument(CT_MapInfo map)
{
this.map = map;
this.mapInfo = map;
}
public CT_MapInfo GetMapInfo()
{
return this.map;
return this.mapInfo;
}
public void SetMapInfo(CT_MapInfo map)
{
this.map = map;
this.mapInfo = map;
}
public void SetComments(CT_MapInfo map)
{
this.map = map;
this.mapInfo = map;
}
public string SelectionNamespaces { get; set; }
public void Save(Stream stream)
{
using (StreamWriter sw = new StreamWriter(stream))
{
sw.Write("<MapInfo xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" SelectionNamespaces=\"xmlns:ns1='http://schemas.openxmlformats.org/spreadsheetml/2006/main'\">");
if (this.map.Schema != null)
{
foreach (CT_Schema ctSchema in this.map.Schema)
{
sw.Write(string.Format("<Schema ID=\"{0}\"", ctSchema.ID));
if (ctSchema.Namespace != null)
sw.Write(string.Format(" Namespace=\"{0}\"", ctSchema.Namespace));
if (ctSchema.SchemaRef != null)
sw.Write(string.Format(" SchemaRef=\"{0}\"", ctSchema.SchemaRef));
sw.Write(">");
sw.Write(ctSchema.InnerXml);
sw.Write("</Schema>");
}
}
if (this.map.Map != null)
{
foreach (CT_Map ctMap in this.map.Map)
{
sw.Write(string.Format("<Map ID=\"{0}\"", ctMap.ID));
if (ctMap.SchemaID != null)
sw.Write(string.Format(" SchemaID=\"{0}\"", ctMap.SchemaID));
if (ctMap.RootElement != null)
sw.Write(string.Format(" RootElement=\"{0}\"", ctMap.RootElement));
if (ctMap.Name != null)
sw.Write(string.Format(" Name=\"{0}\"", ctMap.Name));
if (ctMap.PreserveFormat)
sw.Write(" PreserveFormat=\"true\"");
if (ctMap.PreserveSortAFLayout)
sw.Write(" PreserveSortAFLayout=\"true\"");
if (ctMap.ShowImportExportValidationErrors)
sw.Write(" ShowImportExportValidationErrors=\"true\"");
if (ctMap.Append)
sw.Write(" Append=\"true\"");
if (ctMap.AutoFit)
sw.Write(" AutoFit=\"true\"");
sw.Write(" />");
}
}
sw.Write("</MapInfo");
mapInfo.Write(sw, "MapInfo");
}
}

public static MapInfoDocument Parse(System.Xml.XmlDocument xmldoc, System.Xml.XmlNamespaceManager NameSpaceManager)
public static MapInfoDocument Parse(XmlDocument xmlDoc, XmlNamespaceManager nameSpaceManager)
{
MapInfoDocument doc = new MapInfoDocument();
doc.map = new CT_MapInfo();
doc.map.Map = new System.Collections.Generic.List<CT_Map>();
foreach (XmlElement mapNode in xmldoc.SelectNodes("d:MapInfo/d:Map", NameSpaceManager))
{
CT_Map ctMap=new CT_Map();
ctMap.ID = XmlHelper.ReadUInt(mapNode.GetAttributeNode("ID"));
ctMap.Name = XmlHelper.ReadString(mapNode.GetAttributeNode("Name"));
ctMap.RootElement = XmlHelper.ReadString(mapNode.GetAttributeNode("RootElement"));
ctMap.SchemaID = XmlHelper.ReadString(mapNode.GetAttributeNode("SchemaID"));
ctMap.ShowImportExportValidationErrors = XmlHelper.ReadBool(mapNode.GetAttributeNode("ShowImportExportValidationErrors"));
ctMap.PreserveFormat = XmlHelper.ReadBool(mapNode.GetAttributeNode("PreserveFormat"));
ctMap.PreserveSortAFLayout = XmlHelper.ReadBool(mapNode.GetAttributeNode("PreserveSortAFLayout"));
ctMap.Append = XmlHelper.ReadBool(mapNode.GetAttributeNode("Append"));
ctMap.AutoFit = XmlHelper.ReadBool(mapNode.GetAttributeNode("AutoFit"));
doc.map.Map.Add(ctMap);
}
doc.map.Schema = new System.Collections.Generic.List<CT_Schema>();
foreach (XmlNode schemaNode in xmldoc.SelectNodes("d:MapInfo/d:Schema", NameSpaceManager))
{
CT_Schema ctSchema = new CT_Schema();
ctSchema.ID = schemaNode.Attributes["ID"].Value;
if (schemaNode.Attributes["Namespace"] != null)
ctSchema.Namespace = schemaNode.Attributes["Namespace"].Value;
if (schemaNode.Attributes["SchemaRef"] != null)
ctSchema.SchemaRef = schemaNode.Attributes["SchemaRef"].Value;
ctSchema.InnerXml = schemaNode.InnerXml;
doc.map.Schema.Add(ctSchema);
}
doc.mapInfo = CT_MapInfo.Parse(xmlDoc.DocumentElement, nameSpaceManager);
return doc;
}
}
Expand Down
35 changes: 32 additions & 3 deletions OpenXmlFormats/Spreadsheet/Sheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2694,14 +2694,14 @@ internal void Write(StreamWriter sw, string nodeName)
XmlHelper.WriteAttribute(sw, "t", this.t.ToString());
XmlHelper.WriteAttribute(sw, "aca", this.aca, false);
XmlHelper.WriteAttribute(sw, "ref", this.@ref);
XmlHelper.WriteAttribute(sw, "dt2D", this.dt2D, true);
XmlHelper.WriteAttribute(sw, "dtr", this.dtr, true);
XmlHelper.WriteAttribute(sw, "dt2D", this.dt2D, false);
XmlHelper.WriteAttribute(sw, "dtr", this.dtr, false);
XmlHelper.WriteAttribute(sw, "del1", this.del1, false);
XmlHelper.WriteAttribute(sw, "del2", this.del2, false);
XmlHelper.WriteAttribute(sw, "r1", this.r1);
XmlHelper.WriteAttribute(sw, "r2", this.r2);
XmlHelper.WriteAttribute(sw, "ca", this.ca, false);
if(this.si!=0)
if(this.t == ST_CellFormulaType.shared || this.si!=0)
XmlHelper.WriteAttribute(sw, "si", this.si, true);
XmlHelper.WriteAttribute(sw, "bx", this.bx, false);
if (!string.IsNullOrEmpty(this.valueField))
Expand Down Expand Up @@ -7133,6 +7133,8 @@ public static CT_DataValidations Parse(XmlNode node, XmlNamespaceManager namespa

internal void Write(StreamWriter sw, string nodeName)
{
if (this.countField == 0)
return;
sw.Write(string.Format("<{0}", nodeName));
XmlHelper.WriteAttribute(sw, "disablePrompts", this.disablePrompts);
XmlHelper.WriteAttribute(sw, "xWindow", this.xWindow);
Expand Down Expand Up @@ -7387,6 +7389,33 @@ public void Set(CT_DataValidation obj)
promptField = obj.promptField;
sqrefField = obj.sqrefField;
}

public override bool Equals(object obj)
{
CT_DataValidation o = (CT_DataValidation)obj;

if (o is null)
{
return false;
}

return formula1Field == o.formula1Field
&& formula2Field == o.formula2Field
&& typeField == o.typeField
&& errorStyleField == o.errorStyleField
&& imeModeField == o.imeModeField
&& operatorField == o.operatorField
&& allowBlankField == o.allowBlankField
&& showDropDownField == o.showDropDownField
&& showInputMessageField == o.showInputMessageField
&& showErrorMessageField == o.showErrorMessageField
&& errorTitleField == o.errorTitleField
&& errorField == o.errorField
&& promptTitleField == o.promptTitleField
&& promptField == o.promptField
&& sqrefField == o.sqrefField;
}

[XmlElement(Order = 0)]
public string formula1
{
Expand Down
Loading

0 comments on commit 2015bb7

Please # to comment.