diff --git a/main/HSSF/UserModel/HSSFAnchor.cs b/main/HSSF/UserModel/HSSFAnchor.cs
index 2b48e2ad4..bfd943f16 100644
--- a/main/HSSF/UserModel/HSSFAnchor.cs
+++ b/main/HSSF/UserModel/HSSFAnchor.cs
@@ -16,6 +16,7 @@ limitations Under the License.
==================================================================== */
using NPOI.DDF;
+using NPOI.SS.UserModel;
namespace NPOI.HSSF.UserModel
{
@@ -25,7 +26,7 @@ namespace NPOI.HSSF.UserModel
/// or within another containing shape.
/// @author Glen Stampoultzis (glens at apache.org)
///
- public abstract class HSSFAnchor
+ public abstract class HSSFAnchor: IChildAnchor
{
protected bool _isHorizontallyFlipped = false;
protected bool _isVerticallyFlipped = false;
@@ -69,7 +70,7 @@ public static HSSFAnchor CreateAnchorFromEscher(EscherContainerRecord container)
/// Gets or sets the DX1.
///
/// The DX1.
- public abstract int Dx1
+ public virtual int Dx1
{
get;
set;
@@ -78,7 +79,7 @@ public abstract int Dx1
/// Gets or sets the dy1.
///
/// The dy1.
- public abstract int Dy1
+ public virtual int Dy1
{
get;
set;
@@ -87,7 +88,7 @@ public abstract int Dy1
/// Gets or sets the dy2.
///
/// The dy2.
- public abstract int Dy2
+ public virtual int Dy2
{
get;
set;
@@ -96,7 +97,7 @@ public abstract int Dy2
/// Gets or sets the DX2.
///
/// The DX2.
- public abstract int Dx2
+ public virtual int Dx2
{
get;
set;
diff --git a/main/HSSF/UserModel/HSSFComment.cs b/main/HSSF/UserModel/HSSFComment.cs
index 5886c92af..9ab571a68 100644
--- a/main/HSSF/UserModel/HSSFComment.cs
+++ b/main/HSSF/UserModel/HSSFComment.cs
@@ -251,7 +251,7 @@ public IClientAnchor ClientAnchor
{
get
{
- HSSFAnchor ha = base.Anchor;
+ HSSFAnchor ha = base.Anchor as HSSFAnchor;
if (ha is IClientAnchor)
{
return (IClientAnchor)ha;
diff --git a/main/HSSF/UserModel/HSSFPatriarch.cs b/main/HSSF/UserModel/HSSFPatriarch.cs
index 111bc0a92..4678c65aa 100644
--- a/main/HSSF/UserModel/HSSFPatriarch.cs
+++ b/main/HSSF/UserModel/HSSFPatriarch.cs
@@ -34,7 +34,7 @@ namespace NPOI.HSSF.UserModel
/// little other than act as a container for other shapes and Groups.
/// @author Glen Stampoultzis (glens at apache.org)
///
- public class HSSFPatriarch : HSSFShapeContainer, IDrawing
+ public class HSSFPatriarch : HSSFShapeContainer, IDrawing, IDrawing
{
//private static POILogger log = POILogFactory.GetLogger(typeof(HSSFPatriarch));
List _shapes = new List();
@@ -359,11 +359,11 @@ public IComment CreateCellComment(IClientAnchor anchor)
private void SetFlipFlags(HSSFShape shape)
{
EscherSpRecord sp = (EscherSpRecord)shape.GetEscherContainer().GetChildById(EscherSpRecord.RECORD_ID);
- if (shape.Anchor.IsHorizontallyFlipped)
+ if ((shape.Anchor as HSSFAnchor).IsHorizontallyFlipped)
{
sp.Flags = (sp.Flags | EscherSpRecord.FLAG_FLIPHORIZ);
}
- if (shape.Anchor.IsVerticallyFlipped)
+ if ((shape.Anchor as HSSFAnchor).IsVerticallyFlipped)
{
sp.Flags = (sp.Flags | EscherSpRecord.FLAG_FLIPVERT);
}
diff --git a/main/HSSF/UserModel/HSSFPicture.cs b/main/HSSF/UserModel/HSSFPicture.cs
index 27ccb267d..a1c0672cd 100644
--- a/main/HSSF/UserModel/HSSFPicture.cs
+++ b/main/HSSF/UserModel/HSSFPicture.cs
@@ -309,7 +309,7 @@ public IClientAnchor ClientAnchor
{
get
{
- HSSFAnchor a = Anchor;
+ HSSFAnchor a = Anchor as HSSFAnchor;
return (a is HSSFClientAnchor) ? (HSSFClientAnchor)a : null;
}
}
diff --git a/main/HSSF/UserModel/HSSFPolygon.cs b/main/HSSF/UserModel/HSSFPolygon.cs
index 428c4d4c0..e5095cebe 100644
--- a/main/HSSF/UserModel/HSSFPolygon.cs
+++ b/main/HSSF/UserModel/HSSFPolygon.cs
@@ -95,7 +95,7 @@ protected override EscherContainerRecord CreateSpContainer()
opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x080000));
- EscherRecord anchor = Anchor.GetEscherAnchor();
+ EscherRecord anchor = (Anchor as HSSFAnchor).GetEscherAnchor();
clientData.RecordId = (EscherClientDataRecord.RECORD_ID);
clientData.Options = ((short)0x0000);
diff --git a/main/HSSF/UserModel/HSSFShape.cs b/main/HSSF/UserModel/HSSFShape.cs
index 9d8bf20a4..6eff7e1d1 100644
--- a/main/HSSF/UserModel/HSSFShape.cs
+++ b/main/HSSF/UserModel/HSSFShape.cs
@@ -31,7 +31,7 @@ namespace NPOI.HSSF.UserModel
/// reverse them and draw shapes vertically or horizontally flipped!
///
[Serializable]
- public abstract class HSSFShape //: IShape
+ public abstract class HSSFShape : IShape
{
public const int LINEWIDTH_ONE_PT = 12700; // 12700 = 1pt
public const int LINEWIDTH_DEFAULT = 9525;
@@ -118,21 +118,34 @@ public virtual int ShapeId
cod.ObjectId = (short)(value % 1024);
}
}
+
+ public uint ID
+ {
+ get => (uint)ShapeId;
+ set => ShapeId = (int)value;
+ }
+
+ public string Name
+ {
+ get => ShapeName;
+ set => throw new NotImplementedException();
+ }
+
///
/// Gets the parent shape.
///
/// The parent.
- public HSSFShape Parent
+ public IShape Parent
{
get { return this.parent; }
- set { this.parent = value; }
+ set { this.parent = (HSSFShape)value; }
}
///
/// Gets or sets the anchor that is used by this shape.
///
/// The anchor.
- public HSSFAnchor Anchor
+ public IChildAnchor Anchor
{
get { return anchor; }
set
@@ -179,22 +192,19 @@ public HSSFAnchor Anchor
_escherContainer.RemoveChildRecord(anch);
}
}
+ var anchor = value as HSSFAnchor;
if (-1 == recordId)
{
- _escherContainer.AddChildRecord(value.GetEscherAnchor());
+ _escherContainer.AddChildRecord(anchor.GetEscherAnchor());
}
else
{
- _escherContainer.AddChildBefore(value.GetEscherAnchor(), recordId);
+ _escherContainer.AddChildBefore(anchor.GetEscherAnchor(), recordId);
}
- this.anchor = value;
+ this.anchor = anchor;
}
}
- //public void SetLineStyleColor(int lineStyleColor)
- //{
- // this.lineStyleColor = lineStyleColor;
- //}
///
/// The color applied to the lines of this shape.
///
@@ -264,7 +274,7 @@ public void SetFillColor(int red, int green, int blue)
/// Gets or sets with width of the line in EMUs. 12700 = 1 pt.
///
/// The width of the line.
- public int LineWidth
+ public double LineWidth
{
get
{
@@ -273,7 +283,7 @@ public int LineWidth
}
set
{
- SetPropertyValue(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, value));
+ SetPropertyValue(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, (int)value));
}
}
@@ -435,6 +445,37 @@ public HSSFPatriarch Patriarch
}
}
+ /**
+ * @return the name of this shape
+ */
+ public String ShapeName
+ {
+ get
+ {
+ EscherOptRecord eor = GetOptRecord();
+ if (eor == null)
+ {
+ return null;
+ }
+ EscherProperty ep = eor.Lookup(EscherProperties.GROUPSHAPE__SHAPENAME);
+ if (ep is EscherComplexProperty) {
+ return StringUtil.GetFromUnicodeLE(((EscherComplexProperty)ep).ComplexData);
+ }
+ return null;
+ }
+ }
+
+ public LineEndingCapType LineEndingCapType
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ public CompoundLineType CompoundLineType
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
protected internal ObjRecord GetObjRecord()
{
return _objRecord;
diff --git a/main/HSSF/UserModel/HSSFShapeContainer.cs b/main/HSSF/UserModel/HSSFShapeContainer.cs
index 4854cd26a..3b5d2490a 100644
--- a/main/HSSF/UserModel/HSSFShapeContainer.cs
+++ b/main/HSSF/UserModel/HSSFShapeContainer.cs
@@ -19,12 +19,13 @@ limitations Under the License.
namespace NPOI.HSSF.UserModel
{
using System.Collections.Generic;
+ using NPOI.SS.UserModel;
///
/// An interface that indicates whether a class can contain children.
/// @author Glen Stampoultzis (glens at apache.org)
///
- public interface HSSFShapeContainer : IEnumerable
+ public interface HSSFShapeContainer : IShapeContainer
{
///
/// Gets Any children contained by this shape.
diff --git a/main/HSSF/UserModel/HSSFShapeGroup.cs b/main/HSSF/UserModel/HSSFShapeGroup.cs
index 3a750ecc2..15b77b5e6 100644
--- a/main/HSSF/UserModel/HSSFShapeGroup.cs
+++ b/main/HSSF/UserModel/HSSFShapeGroup.cs
@@ -99,7 +99,7 @@ protected override EscherContainerRecord CreateSpContainer()
opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x00040004));
opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00080000));
- anchor = Anchor.GetEscherAnchor();
+ anchor = this.anchor.GetEscherAnchor();
clientData.RecordId = (EscherClientDataRecord.RECORD_ID);
clientData.Options = ((short)0x0000);
@@ -197,11 +197,11 @@ public HSSFSimpleShape CreateShape(HSSFChildAnchor anchor)
shapes.Add(shape);
OnCreate(shape);
EscherSpRecord sp = (EscherSpRecord)shape.GetEscherContainer().GetChildById(EscherSpRecord.RECORD_ID);
- if (shape.Anchor.IsHorizontallyFlipped)
+ if ((shape.Anchor as HSSFAnchor).IsHorizontallyFlipped)
{
sp.Flags = (sp.Flags | EscherSpRecord.FLAG_FLIPHORIZ);
}
- if (shape.Anchor.IsVerticallyFlipped)
+ if ((shape.Anchor as HSSFAnchor).IsVerticallyFlipped)
{
sp.Flags = (sp.Flags | EscherSpRecord.FLAG_FLIPVERT);
}
@@ -255,11 +255,11 @@ public HSSFPicture CreatePicture(HSSFChildAnchor anchor, int pictureIndex)
shapes.Add(shape);
OnCreate(shape);
EscherSpRecord sp = (EscherSpRecord)shape.GetEscherContainer().GetChildById(EscherSpRecord.RECORD_ID);
- if (shape.Anchor.IsHorizontallyFlipped)
+ if ((shape.Anchor as HSSFAnchor).IsHorizontallyFlipped)
{
sp.Flags = (sp.Flags | EscherSpRecord.FLAG_FLIPHORIZ);
}
- if (shape.Anchor.IsVerticallyFlipped)
+ if ((shape.Anchor as HSSFAnchor).IsVerticallyFlipped)
{
sp.Flags = (sp.Flags | EscherSpRecord.FLAG_FLIPVERT);
}
diff --git a/main/HSSF/UserModel/HSSFSimpleShape.cs b/main/HSSF/UserModel/HSSFSimpleShape.cs
index c0f0b07a2..1edd13bbe 100644
--- a/main/HSSF/UserModel/HSSFSimpleShape.cs
+++ b/main/HSSF/UserModel/HSSFSimpleShape.cs
@@ -26,7 +26,7 @@ namespace NPOI.HSSF.UserModel
/// @author Glen Stampoultzis (glens at apache.org)
///
[Serializable]
- public class HSSFSimpleShape: HSSFShape
+ public class HSSFSimpleShape: HSSFShape, ISimpleShape
{
// The commented out ones haven't been tested yet or aren't supported
// by HSSFSimpleShape.
@@ -223,7 +223,7 @@ protected override EscherContainerRecord CreateSpContainer()
spContainer.AddChildRecord(sp);
spContainer.AddChildRecord(optRecord);
- spContainer.AddChildRecord(this.Anchor.GetEscherAnchor());
+ spContainer.AddChildRecord(this.anchor.GetEscherAnchor());
spContainer.AddChildRecord(clientData);
spContainer.AddChildRecord(escherTextbox);
return spContainer;
diff --git a/main/HSSF/UserModel/HSSFTextbox.cs b/main/HSSF/UserModel/HSSFTextbox.cs
index 82b77a235..aff7aed1c 100644
--- a/main/HSSF/UserModel/HSSFTextbox.cs
+++ b/main/HSSF/UserModel/HSSFTextbox.cs
@@ -102,7 +102,7 @@ protected override EscherContainerRecord CreateSpContainer()
opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, NO_FILLHITTEST_FALSE));
opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x080000));
- EscherRecord anchor = Anchor.GetEscherAnchor();
+ EscherRecord anchor = (Anchor as HSSFAnchor).GetEscherAnchor();
clientData.RecordId = (EscherClientDataRecord.RECORD_ID);
clientData.Options = ((short)0x0000);
escherTextbox.RecordId = (EscherTextboxRecord.RECORD_ID);
diff --git a/main/SS/Formula/Atp/AnalysisToolPak.cs b/main/SS/Formula/Atp/AnalysisToolPak.cs
index 8309a57de..d0b11929c 100644
--- a/main/SS/Formula/Atp/AnalysisToolPak.cs
+++ b/main/SS/Formula/Atp/AnalysisToolPak.cs
@@ -58,11 +58,12 @@ public override FreeRefFunction FindFunction(String name)
{
// functions that are available in Excel 2007+ have a prefix _xlfn.
// if you save such a .xlsx workbook as .xls
- if (name.StartsWith("_xlfn.")) name = name.Substring(6);
+ String prefix = "_xlfn.";
+ if (name.StartsWith(prefix)) name = name.Substring(prefix.Length);
string key = name.ToUpper();
if (_functionsByName.ContainsKey(key))
- return (FreeRefFunction)_functionsByName[key];
+ return _functionsByName[key];
return null;
}
diff --git a/main/SS/UserModel/Drawing.cs b/main/SS/UserModel/Drawing.cs
index a64a42cbf..1924152bb 100644
--- a/main/SS/UserModel/Drawing.cs
+++ b/main/SS/UserModel/Drawing.cs
@@ -66,4 +66,8 @@ public interface IDrawing
IClientAnchor CreateAnchor(int dx1, int dy1, int dx2, int dy2, int col1, int row1, int col2, int row2);
}
+ public interface IDrawing : IShapeContainer where T : class, IShape
+ {
+
+ }
}
\ No newline at end of file
diff --git a/main/SS/UserModel/IChildAnchor.cs b/main/SS/UserModel/IChildAnchor.cs
new file mode 100644
index 000000000..d8de9c016
--- /dev/null
+++ b/main/SS/UserModel/IChildAnchor.cs
@@ -0,0 +1,48 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+
+namespace NPOI.SS.UserModel
+{
+ ///
+ /// Common interface for anchors.
+ ///
+ /// An anchor is what specifics the position of a shape within a client object
+ /// or within another containing shape.
+ ///
+ public interface IChildAnchor
+ {
+ ///
+ /// get or set x coordinate of the left up corner
+ ///
+ int Dx1 { get; set; }
+
+ ///
+ /// get or set y coordinate of the left up corner
+ ///
+ int Dy1 { get; set; }
+
+ ///
+ /// get or set x coordinate of the right down corner
+ ///
+ int Dx2 { get; set; }
+ ///
+ /// get or set y coordinate of the right down corner
+ ///
+ int Dy2 { get; set; }
+ }
+}
diff --git a/main/SS/UserModel/IShapeContainer.cs b/main/SS/UserModel/IShapeContainer.cs
new file mode 100644
index 000000000..5f89de4da
--- /dev/null
+++ b/main/SS/UserModel/IShapeContainer.cs
@@ -0,0 +1,28 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+using System.Collections.Generic;
+
+namespace NPOI.SS.UserModel
+{
+ ///
+ /// A common interface for shape groups.
+ ///
+ ///
+ public interface IShapeContainer : IEnumerable where T : class, IShape
+ {
+ }
+}
diff --git a/main/SS/UserModel/ISimpleShape.cs b/main/SS/UserModel/ISimpleShape.cs
new file mode 100644
index 000000000..d2d07362e
--- /dev/null
+++ b/main/SS/UserModel/ISimpleShape.cs
@@ -0,0 +1,23 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+namespace NPOI.SS.UserModel
+{
+ public interface ISimpleShape : IShape
+ {
+ }
+}
diff --git a/main/SS/UserModel/Picture.cs b/main/SS/UserModel/Picture.cs
index 6bcc2b963..5132b3c24 100644
--- a/main/SS/UserModel/Picture.cs
+++ b/main/SS/UserModel/Picture.cs
@@ -74,7 +74,7 @@ public enum PictureType : int
*
* @author Yegor Kozlov
*/
- public interface IPicture
+ public interface IPicture: IShape
{
/**
diff --git a/main/SS/UserModel/Shape.cs b/main/SS/UserModel/Shape.cs
index a7a0891a4..2e071220c 100644
--- a/main/SS/UserModel/Shape.cs
+++ b/main/SS/UserModel/Shape.cs
@@ -1,17 +1,31 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
namespace NPOI.SS.UserModel
{
public interface IShape
{
+ string ShapeName { get; }
+ IChildAnchor Anchor { get; }
+
IShape Parent { get; }
uint ID { get; }
string Name { get; set; }
-
- void SetLineStyleColor(int lineStyleColor);
void SetLineStyleColor(int red, int green, int blue);
void SetFillColor(int red, int green, int blue);
diff --git a/main/SS/Util/CellReference.cs b/main/SS/Util/CellReference.cs
index b43c91479..de0a2e145 100644
--- a/main/SS/Util/CellReference.cs
+++ b/main/SS/Util/CellReference.cs
@@ -87,7 +87,7 @@ public CellReference(String cellRef) : this(cellRef.AsSpan())
public CellReference(ReadOnlySpan cellRef)
{
- if (cellRef.EndsWith("#REF!".AsSpan(), StringComparison.InvariantCulture))
+ if (cellRef.EndsWith("#REF!".AsSpan(), StringComparison.OrdinalIgnoreCase))
{
throw new ArgumentException("Cell reference invalid: " + cellRef.ToString());
}
diff --git a/ooxml/XSSF/Streaming/SXSSFDrawing.cs b/ooxml/XSSF/Streaming/SXSSFDrawing.cs
index d8a7402a1..7cfbf9471 100644
--- a/ooxml/XSSF/Streaming/SXSSFDrawing.cs
+++ b/ooxml/XSSF/Streaming/SXSSFDrawing.cs
@@ -19,13 +19,15 @@ namespace NPOI.XSSF.Streaming
{
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
+ using System.Collections;
+ using System.Collections.Generic;
///
/// Streaming version of Drawing.
/// Delegates most tasks to the non-streaming XSSF code.
/// TODO: Potentially, Comment and Chart need a similar streaming wrapper like Picture.
///
- public class SXSSFDrawing : IDrawing
+ public class SXSSFDrawing : IDrawing, IDrawing
{
private SXSSFWorkbook _wb;
private XSSFDrawing _drawing;
@@ -52,6 +54,16 @@ public IClientAnchor CreateAnchor(int dx1, int dy1, int dx2, int dy2, int col1,
{
return _drawing.CreateAnchor(dx1, dy1, dx2, dy2, col1, row1, col2, row2);
}
+
+ public IEnumerator GetEnumerator()
+ {
+ return _drawing.GetShapes().GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return this.GetEnumerator();
+ }
//public ObjectData CreateObjectData(IClientAnchor anchor, int storageId, int pictureIndex)
//{
// return _drawing.CreateObjectData(anchor, storageId, pictureIndex);
diff --git a/ooxml/XSSF/Streaming/SXSSFPicture.cs b/ooxml/XSSF/Streaming/SXSSFPicture.cs
index 491611a03..b2e822f78 100644
--- a/ooxml/XSSF/Streaming/SXSSFPicture.cs
+++ b/ooxml/XSSF/Streaming/SXSSFPicture.cs
@@ -313,6 +313,26 @@ public bool IsNoFill
set { _picture.IsNoFill = value;}
}
+ public string ShapeName => this.GetShapeName();
+
+ public IChildAnchor Anchor => GetAnchor();
+
+ public IShape Parent => GetParent();
+
+ public uint ID => _picture.ID;
+
+ public string Name { get => this.GetShapeName(); set => throw new System.NotImplementedException(); }
+
+ public int LineStyleColor => _picture.LineStyleColor;
+
+ public int FillColor { get => _picture.FillColor; set => throw new System.NotImplementedException(); }
+ public double LineWidth { get => _picture.LineWidth; set => throw new System.NotImplementedException(); }
+ public LineStyle LineStyle { get => _picture.LineStyle; set => throw new System.NotImplementedException(); }
+ public LineEndingCapType LineEndingCapType { get => _picture.LineEndingCapType; set => throw new System.NotImplementedException(); }
+ public CompoundLineType CompoundLineType { get => _picture.CompoundLineType; set => throw new System.NotImplementedException(); }
+
+ public int CountOfAllChildren => _picture.CountOfAllChildren;
+
public void SetFillColor(int red, int green, int blue)
{
_picture.SetFillColor(red, green, blue);
diff --git a/ooxml/XSSF/UserModel/XSSFAnchor.cs b/ooxml/XSSF/UserModel/XSSFAnchor.cs
index 7ff3133af..2b0804590 100644
--- a/ooxml/XSSF/UserModel/XSSFAnchor.cs
+++ b/ooxml/XSSF/UserModel/XSSFAnchor.cs
@@ -1,4 +1,5 @@
-using System;
+using NPOI.SS.UserModel;
+using System;
using System.Collections.Generic;
using System.Text;
@@ -10,7 +11,7 @@ namespace NPOI.XSSF.UserModel
*
* @author Yegor Kozlov
*/
- public abstract class XSSFAnchor
+ public abstract class XSSFAnchor: IChildAnchor
{
public abstract int Dx1 { get; set; }
public abstract int Dy1 { get; set; }
diff --git a/ooxml/XSSF/UserModel/XSSFConnector.cs b/ooxml/XSSF/UserModel/XSSFConnector.cs
index 7dc40b9dc..e83f0fd00 100644
--- a/ooxml/XSSF/UserModel/XSSFConnector.cs
+++ b/ooxml/XSSF/UserModel/XSSFConnector.cs
@@ -134,6 +134,7 @@ protected internal override NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_ShapeProperti
return ctShape.spPr;
}
+ public override string ShapeName => ctShape.nvCxnSpPr.cNvPr.name;
}
}
diff --git a/ooxml/XSSF/UserModel/XSSFGraphicFrame.cs b/ooxml/XSSF/UserModel/XSSFGraphicFrame.cs
index 94e36e54b..b13b67b75 100644
--- a/ooxml/XSSF/UserModel/XSSFGraphicFrame.cs
+++ b/ooxml/XSSF/UserModel/XSSFGraphicFrame.cs
@@ -135,7 +135,7 @@ private NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_NonVisualDrawingProps GetNonVisua
* Returns the frame anchor.
* @return the anchor this frame is attached to
*/
- public XSSFClientAnchor Anchor
+ public new XSSFClientAnchor Anchor
{
get
{
@@ -208,6 +208,8 @@ protected internal override NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_ShapeProperti
{
return null;
}
+
+ public override string ShapeName => graphicFrame.nvGraphicFramePr.cNvPr.name;
}
}
diff --git a/ooxml/XSSF/UserModel/XSSFPicture.cs b/ooxml/XSSF/UserModel/XSSFPicture.cs
index 3c226eb40..ae6577c3b 100644
--- a/ooxml/XSSF/UserModel/XSSFPicture.cs
+++ b/ooxml/XSSF/UserModel/XSSFPicture.cs
@@ -389,6 +389,8 @@ public ISheet Sheet
return (XSSFSheet)this.GetDrawing().GetParent();
}
}
+
+ public override string ShapeName => ctPicture.nvPicPr.cNvPr.name;
}
}
diff --git a/ooxml/XSSF/UserModel/XSSFShape.cs b/ooxml/XSSF/UserModel/XSSFShape.cs
index 4b6180947..1d9fe2b1a 100644
--- a/ooxml/XSSF/UserModel/XSSFShape.cs
+++ b/ooxml/XSSF/UserModel/XSSFShape.cs
@@ -26,7 +26,7 @@ namespace NPOI.XSSF.UserModel
*
* @author Yegor Kozlov
*/
- public abstract class XSSFShape:IShape
+ public abstract class XSSFShape: IShape
{
public static int EMU_PER_PIXEL = 9525;
public static int EMU_PER_POINT = 12700;
@@ -50,6 +50,9 @@ public abstract class XSSFShape:IShape
*/
internal XSSFAnchor anchor;
+ public virtual string ShapeName => throw new System.NotImplementedException();
+
+ public virtual IChildAnchor Anchor => throw new System.NotImplementedException();
/**
* Return the Drawing that owns this shape
*
@@ -243,11 +246,6 @@ public virtual double LineWidth
}
}
- public void SetLineStyleColor(int lineStyleColor)
- {
- throw new System.NotImplementedException();
- }
-
public virtual LineEndingCapType LineEndingCapType
{
get
diff --git a/ooxml/XSSF/UserModel/XSSFSimpleShape.cs b/ooxml/XSSF/UserModel/XSSFSimpleShape.cs
index 82a981f60..c623db709 100644
--- a/ooxml/XSSF/UserModel/XSSFSimpleShape.cs
+++ b/ooxml/XSSF/UserModel/XSSFSimpleShape.cs
@@ -32,7 +32,7 @@ namespace NPOI.XSSF.UserModel
* Represents a shape with a predefined geometry in a SpreadsheetML Drawing.
* Possible shape types are defined in {@link NPOI.SS.UserModel.ShapeTypes}
*/
- public class XSSFSimpleShape : XSSFShape, IEnumerable
+ public class XSSFSimpleShape : XSSFShape, IEnumerable, ISimpleShape
{ // TODO - instantiable superclass
/**
* List of the paragraphs that make up the text in this shape
@@ -1014,5 +1014,7 @@ private static void ApplyAttributes(CT_RPrElt pr, CT_TextCharacterProperties rPr
}
}
}
+
+ public override string ShapeName => ctShape.nvSpPr.cNvPr.name;
}
}
\ No newline at end of file
diff --git a/testcases/main/HSSF/Model/TestDrawingShapes.cs b/testcases/main/HSSF/Model/TestDrawingShapes.cs
index 5372cfd42..94212e48d 100644
--- a/testcases/main/HSSF/Model/TestDrawingShapes.cs
+++ b/testcases/main/HSSF/Model/TestDrawingShapes.cs
@@ -14,18 +14,15 @@ the License. You may obtain a copy of the License at
See the License for the specific language governing permissions and
limitations Under the License.
==================================================================== */
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using NUnit.Framework;
-using NPOI.HSSF.UserModel;
-using NPOI.HSSF.Model;
using NPOI.DDF;
using NPOI.HSSF.Record;
+using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
-using TestCases.HSSF.UserModel;
using NPOI.Util;
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using TestCases.HSSF.UserModel;
namespace TestCases.HSSF.Model
{
@@ -796,7 +793,7 @@ private void CheckWorkbookBack(HSSFWorkbook wb)
Assert.AreEqual(4, children.Count);
HSSFShape hssfShape = children[(0)];
Assert.IsTrue(hssfShape is HSSFSimpleShape);
- HSSFAnchor anchor = hssfShape.Anchor;
+ HSSFAnchor anchor = hssfShape.Anchor as HSSFAnchor;
Assert.IsTrue(anchor is HSSFClientAnchor);
Assert.AreEqual(0, anchor.Dx1);
Assert.AreEqual(512, anchor.Dx2);
@@ -810,7 +807,7 @@ private void CheckWorkbookBack(HSSFWorkbook wb)
hssfShape = children[(1)];
Assert.IsTrue(hssfShape is HSSFSimpleShape);
- anchor = hssfShape.Anchor;
+ anchor = hssfShape.Anchor as HSSFAnchor;
Assert.IsTrue(anchor is HSSFClientAnchor);
Assert.AreEqual(512, anchor.Dx1);
Assert.AreEqual(1023, anchor.Dx2);
@@ -824,7 +821,7 @@ private void CheckWorkbookBack(HSSFWorkbook wb)
hssfShape = children[(2)];
Assert.IsTrue(hssfShape is HSSFSimpleShape);
- anchor = hssfShape.Anchor;
+ anchor = hssfShape.Anchor as HSSFAnchor;
Assert.IsTrue(anchor is HSSFClientAnchor);
Assert.AreEqual(0, anchor.Dx1);
Assert.AreEqual(512, anchor.Dx2);
@@ -838,7 +835,7 @@ private void CheckWorkbookBack(HSSFWorkbook wb)
hssfShape = children[(3)];
Assert.IsTrue(hssfShape is HSSFSimpleShape);
- anchor = hssfShape.Anchor;
+ anchor = hssfShape.Anchor as HSSFAnchor;
Assert.IsTrue(anchor is HSSFClientAnchor);
Assert.AreEqual(0, anchor.Dx1);
Assert.AreEqual(512, anchor.Dx2);
diff --git a/testcases/main/HSSF/UserModel/TestHSSFPicture.cs b/testcases/main/HSSF/UserModel/TestHSSFPicture.cs
index 68eb1f217..7d29c8bfa 100644
--- a/testcases/main/HSSF/UserModel/TestHSSFPicture.cs
+++ b/testcases/main/HSSF/UserModel/TestHSSFPicture.cs
@@ -51,7 +51,7 @@ public void Resize()
HSSFPicture cmpPic = (HSSFPicture)pics[(1)];
BaseTestResize(inpPic, cmpPic, 2.0, 2.0);
- //wb.Close();
+ wb.Close();
}
@@ -69,6 +69,8 @@ public void Bug45829()
int idx1 = wb.AddPicture(pictureData, PictureType.PNG);
IPicture pic = p1.CreatePicture(new HSSFClientAnchor(), idx1);
pic.Resize();
+
+ wb.Close();
}
[Test]
public void AddPictures()
@@ -163,6 +165,8 @@ public void AddPictures()
Assert.IsTrue(Arrays.Equals(data2, ((HSSFPicture)((HSSFPatriarch)dr).Children[(1)]).PictureData.Data));
Assert.IsTrue(Arrays.Equals(data3, ((HSSFPicture)((HSSFPatriarch)dr).Children[(2)]).PictureData.Data));
Assert.IsTrue(Arrays.Equals(data4, ((HSSFPicture)((HSSFPatriarch)dr).Children[(3)]).PictureData.Data));
+
+ wb.Close();
}
[Test]
public void BSEPictureRef()
@@ -201,6 +205,8 @@ public void ReadExistingImage()
HSSFPicture picture = (HSSFPicture)Drawing.Children[0];
Assert.AreEqual(picture.FileName, "test");
+
+ wb.Close();
}
[Test]
public void SetGetProperties()
@@ -226,6 +232,8 @@ public void SetGetProperties()
p1 = (HSSFPicture)dr.Children[0];
Assert.AreEqual(p1.FileName, "aaa");
+
+ wb.Close();
}
[Test]
@@ -275,6 +283,8 @@ public void Bug49658()
Array.Copy(pictureDataWmf, 22, wmfNoHeader, 0, pictureDataWmf.Length - 22);
pictureDataOut = (wb.GetAllPictures()[2] as HSSFPictureData).Data;
Assert.IsTrue(Arrays.Equals(wmfNoHeader, pictureDataOut));
+
+ wb.Close();
}
}
diff --git a/testcases/main/HSSF/UserModel/TestHSSFSheet.cs b/testcases/main/HSSF/UserModel/TestHSSFSheet.cs
index 0cc5e0e9e..0a0555abd 100644
--- a/testcases/main/HSSF/UserModel/TestHSSFSheet.cs
+++ b/testcases/main/HSSF/UserModel/TestHSSFSheet.cs
@@ -200,49 +200,6 @@ public void TestWSBool()
wb.Close();
}
- [Test]
- [Ignore("not fount in poi")]
- public void TestReadBooleans()
- {
- HSSFWorkbook wb1 = new HSSFWorkbook();
- NPOI.SS.UserModel.ISheet sheet = wb1.CreateSheet("Test boolean");
- IRow row = sheet.CreateRow(2);
- ICell cell = row.CreateCell(9);
- cell.SetCellValue(true);
- cell = row.CreateCell(11);
- cell.SetCellValue(true);
-
- IWorkbook wb2 = HSSFTestDataSamples.WriteOutAndReadBack(wb1);
- wb1.Close();
-
- sheet = wb2.GetSheetAt(0);
- row = sheet.GetRow(2);
- Assert.IsNotNull(row);
- Assert.AreEqual(2, row.PhysicalNumberOfCells);
-
- wb2.Close();
- }
- [Test]
- [Ignore("not fount in poi")]
- public void TestRemoveZeroRow()
- {
- HSSFWorkbook workbook = new HSSFWorkbook();
- NPOI.SS.UserModel.ISheet sheet = workbook.CreateSheet("Sheet1");
- IRow row = sheet.CreateRow(0);
- try
- {
- sheet.RemoveRow(row);
- }
- catch (ArgumentException e)
- {
- if (e.Message.Equals("Invalid row number (-1) outside allowable range (0..65535)"))
- {
- throw new AssertionException("Identified bug 45367");
- }
- throw e;
- }
- }
-
/**
* Setting landscape and portrait stuff on existing sheets
@@ -552,7 +509,7 @@ public void TestDvProtectionOrder_bug47363b()
Assert.Fail("Identified bug 47363b");
}
workbook.Close();
- throw e;
+ throw;
}
TestCases.HSSF.UserModel.RecordInspector.RecordCollector rc;
rc = new RecordInspector.RecordCollector();
diff --git a/testcases/main/HSSF/UserModel/TestHSSFWorkbook.cs b/testcases/main/HSSF/UserModel/TestHSSFWorkbook.cs
index bab4e007a..e003db922 100644
--- a/testcases/main/HSSF/UserModel/TestHSSFWorkbook.cs
+++ b/testcases/main/HSSF/UserModel/TestHSSFWorkbook.cs
@@ -17,29 +17,23 @@ limitations under the License.
namespace TestCases.HSSF.UserModel
{
- using System;
- using System.IO;
- using System.Collections;
-
- using TestCases.HSSF;
+ using NPOI.DDF;
+ using NPOI.HSSF;
using NPOI.HSSF.Model;
using NPOI.HSSF.Record;
- using NPOI.SS.Formula;
- using NPOI.Util;
using NPOI.HSSF.UserModel;
- using NUnit.Framework;
- using NPOI.DDF;
- using TestCases.SS.UserModel;
+ using NPOI.POIFS.FileSystem;
using NPOI.SS.Formula.PTG;
using NPOI.SS.UserModel;
- using NPOI.POIFS.FileSystem;
using NPOI.SS.Util;
+ using NPOI.Util;
+ using NUnit.Framework;
+ using System;
+ using System.Collections;
using System.Collections.Generic;
- using System.Text;
- using NPOI.HSSF;
- using System.Threading;
- using System.Globalization;
- using NPOI.SS;
+ using System.IO;
+ using TestCases.HSSF;
+ using TestCases.SS.UserModel;
/**
*
@@ -68,7 +62,7 @@ private static HSSFWorkbook OpenSample(String sampleFileName)
* @throws IOException
*/
[Test]
- public void Hidden()
+ public void TestHidden()
{
HSSFWorkbook wb = new HSSFWorkbook();
@@ -96,90 +90,6 @@ public void Hidden()
wb.Close();
}
- [Test]
- [Ignore("not found in poi")]
- public void CaseInsensitiveNames()
- {
- HSSFWorkbook b = new HSSFWorkbook();
- ISheet originalSheet = b.CreateSheet("Sheet1");
- ISheet fetchedSheet = b.GetSheet("sheet1");
- if (fetchedSheet == null)
- {
- throw new AssertionException("Identified bug 44892");
- }
- Assert.AreEqual(originalSheet, fetchedSheet);
- try
- {
- b.CreateSheet("sHeeT1");
- Assert.Fail("should have thrown exceptiuon due to duplicate sheet name");
- }
- catch (ArgumentException e)
- {
- // expected during successful Test
- Assert.AreEqual("The workbook already contains a sheet of this name", e.Message);
- }
- }
- [Test]
- [Ignore("not found in poi")]
- public void DuplicateNames()
- {
- HSSFWorkbook b = new HSSFWorkbook();
- b.CreateSheet("Sheet1");
- b.CreateSheet();
- b.CreateSheet("name1");
- try
- {
- b.CreateSheet("name1");
- Assert.Fail();
- }
- catch (ArgumentException)// pass
- {
- }
- b.CreateSheet();
- try
- {
- b.SetSheetName(3, "name1");
- Assert.Fail();
- }
- catch (ArgumentException)// pass
- {
- }
-
- try
- {
- b.SetSheetName(3, "name1");
- Assert.Fail();
- }
- catch (ArgumentException)// pass
- {
- }
-
- b.SetSheetName(3, "name2");
- b.SetSheetName(3, "name2");
- b.SetSheetName(3, "name2");
-
- HSSFWorkbook c = new HSSFWorkbook();
- c.CreateSheet("Sheet1");
- c.CreateSheet("Sheet2");
- c.CreateSheet("Sheet3");
- c.CreateSheet("Sheet4");
-
- }
-
- [Test]
- [Ignore("not found in poi")]
- public new void TestSheetSelection()
- {
- HSSFWorkbook b = new HSSFWorkbook();
- b.CreateSheet("Sheet One");
- b.CreateSheet("Sheet Two");
- b.SetActiveSheet(1);
- b.SetSelectedTab(1);
- b.FirstVisibleTab = (1);
- Assert.AreEqual(1, b.ActiveSheetIndex);
- Assert.AreEqual(1, b.FirstVisibleTab);
- }
-
[Test]
public void ReadWriteWithCharts()
{
@@ -1219,11 +1129,10 @@ public void Best49423()
IList shapes = (sheet.DrawingPatriarch as HSSFPatriarch).Children;
foreach (HSSFShape shape in shapes)
{
- HSSFAnchor anchor = shape.Anchor;
+ HSSFAnchor anchor = shape.Anchor as HSSFAnchor;
if (anchor is HSSFClientAnchor)
- {
- // absolute coordinates
+ { // absolute coordinates
HSSFClientAnchor clientAnchor = (HSSFClientAnchor)anchor;
Assert.IsNotNull(clientAnchor);
//System.out.Println(clientAnchor.Row1 + "," + clientAnchor.Row2);
diff --git a/testcases/main/HSSF/UserModel/TestUnicodeWorkbook.cs b/testcases/main/HSSF/UserModel/TestUnicodeWorkbook.cs
index 98a5dbaaf..e5ee35611 100644
--- a/testcases/main/HSSF/UserModel/TestUnicodeWorkbook.cs
+++ b/testcases/main/HSSF/UserModel/TestUnicodeWorkbook.cs
@@ -32,86 +32,6 @@ public TestUnicodeWorkbook()
}
- /** Tests that all of the unicode capable string fields can be set, written and then read back
- *
- *
- */
- //[Test]
- //public void TestUnicodeInAll()
- //{
- // HSSFWorkbook wb = new HSSFWorkbook();
- // //Create a unicode dataformat (contains euro symbol)
- // DataFormat df = wb.CreateDataFormat();
- // String formatStr = "_([$\u20ac-2]\\\\\\ * #,##0.00_);_([$\u20ac-2]\\\\\\ * \\\\\\(#,##0.00\\\\\\);_([$\u20ac-2]\\\\\\ *\\\"\\-\\\\\"??_);_(@_)";
- // short fmt = df.GetFormat(formatStr);
-
- // //Create a unicode sheet name (euro symbol)
- // NPOI.SS.UserModel.Sheet s = wb.CreateSheet("\u20ac");
-
- // //Set a unicode header (you guessed it the euro symbol)
- // HSSFHeader h = s.Header;
- // h.Center = ("\u20ac");
- // h.Left = ("\u20ac");
- // h.Right = ("\u20ac");
-
- // //Set a unicode footer
- // HSSFFooter f = s.Footer;
- // f.Center = ("\u20ac");
- // f.Left = ("\u20ac");
- // f.Right = ("\u20ac");
-
- // Row r = s.CreateRow(0);
- // Cell c = r.CreateCell(1);
- // c.SetCellValue(12.34);
- // c.CellStyle.DataFormat = (fmt);
-
- // Cell c2 = r.CreateCell(2);
- // c.SetCellValue(new HSSFRichTextString("\u20ac"));
-
- // Cell c3 = r.CreateCell(3);
- // String formulaString = "TEXT(12.34,\"\u20ac###,##\")";
- // c3.CellFormula = (formulaString);
-
-
- // string path = NPOI.Util.TempFile.GetTempFilePath("unicode", "Test.xls");
- // FileStream tempFile = File.Create(path);
- // wb.Write(tempFile);
- // wb = null;
- // tempFile.Close();
- // FileStream in1 = new FileStream(path,FileMode.Open);
- // wb = new HSSFWorkbook(in1);
-
- // //Test the sheetname
- // s = wb.GetSheet("\u20ac");
- // Assert.IsNotNull(s);
-
- // //Test the header
- // h = s.Header;
- // Assert.AreEqual(h.Center, "\u20ac");
- // Assert.AreEqual(h.Left, "\u20ac");
- // Assert.AreEqual(h.Right, "\u20ac");
-
- // //Test the footer
- // f = s.Footer;
- // Assert.AreEqual(f.Center, "\u20ac");
- // Assert.AreEqual(f.Left, "\u20ac");
- // Assert.AreEqual(f.Right, "\u20ac");
-
- // //Test the dataformat
- // r = s.GetRow(0);
- // c = r.GetCell(1);
- // df = wb.CreateDataFormat();
- // Assert.AreEqual(formatStr, df.GetFormat(c.CellStyle.DataFormat));
-
- // //Test the cell string value
- // c2 = r.GetCell(2);
- // Assert.AreEqual(c.RichStringCellValue.String, "\u20ac");
-
- // //Test the cell formula
- // c3 = r.GetCell(3);
- // Assert.AreEqual(c3.CellFormula, formulaString);
- //}
-
/** Tests Bug38230
* That a Umlat is written and then read back.
* It should have been written as a compressed unicode.
@@ -134,17 +54,8 @@ public void TestUmlatReadWrite()
//Confirm that the sring will be compressed
Assert.AreEqual(((HSSFRichTextString)c.RichStringCellValue).UnicodeString.OptionFlags, 0);
- string path = NPOI.Util.TempFile.GetTempFilePath("umlat", "Test.xls");
- FileStream tempFile = File.Create(path);
-
- wb.Write(tempFile);
+ wb = HSSFTestDataSamples.WriteOutAndReadBack(wb);
- tempFile.Close();
- wb = null;
-
- FileStream in1 = File.Open(path,FileMode.Open);
- wb = new HSSFWorkbook(in1);
- in1.Close();
//Test the sheetname
s = wb.GetSheet("Test");
Assert.IsNotNull(s);
diff --git a/testcases/ooxml/XSSF/UserModel/TestXSSFSheet.cs b/testcases/ooxml/XSSF/UserModel/TestXSSFSheet.cs
index e2ddaae7b..54e71c757 100644
--- a/testcases/ooxml/XSSF/UserModel/TestXSSFSheet.cs
+++ b/testcases/ooxml/XSSF/UserModel/TestXSSFSheet.cs
@@ -443,32 +443,32 @@ public void TestSetColumnGroupCollapsed()
Assert.AreEqual(2, cols.sizeOfColArray());
- Assert.AreEqual(false, cols.GetColArray(0).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(0).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(0).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(0).IsSetCollapsed());
Assert.AreEqual(5, cols.GetColArray(0).min); // 1 based
Assert.AreEqual(8, cols.GetColArray(0).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(1).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(1).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(1).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(1).IsSetCollapsed());
Assert.AreEqual(10, cols.GetColArray(1).min); // 1 based
Assert.AreEqual(13, cols.GetColArray(1).max); // 1 based
sheet1.GroupColumn((short)10, (short)11);
Assert.AreEqual(4, cols.sizeOfColArray());
- Assert.AreEqual(false, cols.GetColArray(0).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(0).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(0).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(0).IsSetCollapsed());
Assert.AreEqual(5, cols.GetColArray(0).min); // 1 based
Assert.AreEqual(8, cols.GetColArray(0).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(1).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(1).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(1).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(1).IsSetCollapsed());
Assert.AreEqual(10, cols.GetColArray(1).min); // 1 based
Assert.AreEqual(10, cols.GetColArray(1).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(2).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(2).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(2).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(2).IsSetCollapsed());
Assert.AreEqual(11, cols.GetColArray(2).min); // 1 based
Assert.AreEqual(12, cols.GetColArray(2).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(3).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(3).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(3).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(3).IsSetCollapsed());
Assert.AreEqual(13, cols.GetColArray(3).min); // 1 based
Assert.AreEqual(13, cols.GetColArray(3).max); // 1 based
@@ -476,24 +476,24 @@ public void TestSetColumnGroupCollapsed()
sheet1.SetColumnGroupCollapsed((short)5, true);
Assert.AreEqual(5, cols.sizeOfColArray());
- Assert.AreEqual(true, cols.GetColArray(0).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(0).IsSetCollapsed());
+ Assert.IsTrue(cols.GetColArray(0).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(0).IsSetCollapsed());
Assert.AreEqual(5, cols.GetColArray(0).min); // 1 based
Assert.AreEqual(8, cols.GetColArray(0).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(1).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(1).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(1).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(1).IsSetCollapsed());
Assert.AreEqual(9, cols.GetColArray(1).min); // 1 based
Assert.AreEqual(9, cols.GetColArray(1).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(2).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(2).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(2).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(2).IsSetCollapsed());
Assert.AreEqual(10, cols.GetColArray(2).min); // 1 based
Assert.AreEqual(10, cols.GetColArray(2).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(3).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(3).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(3).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(3).IsSetCollapsed());
Assert.AreEqual(11, cols.GetColArray(3).min); // 1 based
Assert.AreEqual(12, cols.GetColArray(3).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(4).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(4).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(4).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(4).IsSetCollapsed());
Assert.AreEqual(13, cols.GetColArray(4).min); // 1 based
Assert.AreEqual(13, cols.GetColArray(4).max); // 1 based
@@ -501,24 +501,24 @@ public void TestSetColumnGroupCollapsed()
// expand columns - 1
sheet1.SetColumnGroupCollapsed((short)5, false);
- Assert.AreEqual(false, cols.GetColArray(0).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(0).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(0).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(0).IsSetCollapsed());
Assert.AreEqual(5, cols.GetColArray(0).min); // 1 based
Assert.AreEqual(8, cols.GetColArray(0).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(1).IsSetHidden());
- Assert.AreEqual(false, cols.GetColArray(1).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(1).IsSetHidden());
+ Assert.IsFalse(cols.GetColArray(1).IsSetCollapsed());
Assert.AreEqual(9, cols.GetColArray(1).min); // 1 based
Assert.AreEqual(9, cols.GetColArray(1).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(2).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(2).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(2).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(2).IsSetCollapsed());
Assert.AreEqual(10, cols.GetColArray(2).min); // 1 based
Assert.AreEqual(10, cols.GetColArray(2).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(3).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(3).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(3).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(3).IsSetCollapsed());
Assert.AreEqual(11, cols.GetColArray(3).min); // 1 based
Assert.AreEqual(12, cols.GetColArray(3).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(4).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(4).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(4).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(4).IsSetCollapsed());
Assert.AreEqual(13, cols.GetColArray(4).min); // 1 based
Assert.AreEqual(13, cols.GetColArray(4).max); // 1 based
@@ -526,28 +526,28 @@ public void TestSetColumnGroupCollapsed()
//collapse - 2
sheet1.SetColumnGroupCollapsed((short)9, true);
Assert.AreEqual(6, cols.sizeOfColArray());
- Assert.AreEqual(false, cols.GetColArray(0).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(0).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(0).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(0).IsSetCollapsed());
Assert.AreEqual(5, cols.GetColArray(0).min); // 1 based
Assert.AreEqual(8, cols.GetColArray(0).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(1).IsSetHidden());
- Assert.AreEqual(false, cols.GetColArray(1).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(1).IsSetHidden());
+ Assert.IsFalse(cols.GetColArray(1).IsSetCollapsed());
Assert.AreEqual(9, cols.GetColArray(1).min); // 1 based
Assert.AreEqual(9, cols.GetColArray(1).max); // 1 based
- Assert.AreEqual(true, cols.GetColArray(2).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(2).IsSetCollapsed());
+ Assert.IsTrue(cols.GetColArray(2).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(2).IsSetCollapsed());
Assert.AreEqual(10, cols.GetColArray(2).min); // 1 based
Assert.AreEqual(10, cols.GetColArray(2).max); // 1 based
- Assert.AreEqual(true, cols.GetColArray(3).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(3).IsSetCollapsed());
+ Assert.IsTrue(cols.GetColArray(3).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(3).IsSetCollapsed());
Assert.AreEqual(11, cols.GetColArray(3).min); // 1 based
Assert.AreEqual(12, cols.GetColArray(3).max); // 1 based
- Assert.AreEqual(true, cols.GetColArray(4).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(4).IsSetCollapsed());
+ Assert.IsTrue(cols.GetColArray(4).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(4).IsSetCollapsed());
Assert.AreEqual(13, cols.GetColArray(4).min); // 1 based
Assert.AreEqual(13, cols.GetColArray(4).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(5).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(5).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(5).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(5).IsSetCollapsed());
Assert.AreEqual(14, cols.GetColArray(5).min); // 1 based
Assert.AreEqual(14, cols.GetColArray(5).max); // 1 based
@@ -559,30 +559,30 @@ public void TestSetColumnGroupCollapsed()
//outline level 2: the line under ==> collapsed==True
Assert.AreEqual(2, cols.GetColArray(3).outlineLevel);
- Assert.AreEqual(true, cols.GetColArray(4).IsSetCollapsed());
+ Assert.IsTrue(cols.GetColArray(4).IsSetCollapsed());
- Assert.AreEqual(false, cols.GetColArray(0).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(0).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(0).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(0).IsSetCollapsed());
Assert.AreEqual(5, cols.GetColArray(0).min); // 1 based
Assert.AreEqual(8, cols.GetColArray(0).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(1).IsSetHidden());
- Assert.AreEqual(false, cols.GetColArray(1).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(1).IsSetHidden());
+ Assert.IsFalse(cols.GetColArray(1).IsSetCollapsed());
Assert.AreEqual(9, cols.GetColArray(1).min); // 1 based
Assert.AreEqual(9, cols.GetColArray(1).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(2).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(2).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(2).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(2).IsSetCollapsed());
Assert.AreEqual(10, cols.GetColArray(2).min); // 1 based
Assert.AreEqual(10, cols.GetColArray(2).max); // 1 based
- Assert.AreEqual(true, cols.GetColArray(3).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(3).IsSetCollapsed());
+ Assert.IsTrue(cols.GetColArray(3).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(3).IsSetCollapsed());
Assert.AreEqual(11, cols.GetColArray(3).min); // 1 based
Assert.AreEqual(12, cols.GetColArray(3).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(4).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(4).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(4).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(4).IsSetCollapsed());
Assert.AreEqual(13, cols.GetColArray(4).min); // 1 based
Assert.AreEqual(13, cols.GetColArray(4).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(5).IsSetHidden());
- Assert.AreEqual(false, cols.GetColArray(5).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(5).IsSetHidden());
+ Assert.IsFalse(cols.GetColArray(5).IsSetCollapsed());
Assert.AreEqual(14, cols.GetColArray(5).min); // 1 based
Assert.AreEqual(14, cols.GetColArray(5).max); // 1 based
@@ -590,28 +590,28 @@ public void TestSetColumnGroupCollapsed()
//collapse - 3
sheet1.SetColumnGroupCollapsed((short)10, true);
Assert.AreEqual(6, cols.sizeOfColArray());
- Assert.AreEqual(false, cols.GetColArray(0).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(0).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(0).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(0).IsSetCollapsed());
Assert.AreEqual(5, cols.GetColArray(0).min); // 1 based
Assert.AreEqual(8, cols.GetColArray(0).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(1).IsSetHidden());
- Assert.AreEqual(false, cols.GetColArray(1).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(1).IsSetHidden());
+ Assert.IsFalse(cols.GetColArray(1).IsSetCollapsed());
Assert.AreEqual(9, cols.GetColArray(1).min); // 1 based
Assert.AreEqual(9, cols.GetColArray(1).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(2).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(2).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(2).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(2).IsSetCollapsed());
Assert.AreEqual(10, cols.GetColArray(2).min); // 1 based
Assert.AreEqual(10, cols.GetColArray(2).max); // 1 based
- Assert.AreEqual(true, cols.GetColArray(3).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(3).IsSetCollapsed());
+ Assert.IsTrue(cols.GetColArray(3).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(3).IsSetCollapsed());
Assert.AreEqual(11, cols.GetColArray(3).min); // 1 based
Assert.AreEqual(12, cols.GetColArray(3).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(4).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(4).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(4).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(4).IsSetCollapsed());
Assert.AreEqual(13, cols.GetColArray(4).min); // 1 based
Assert.AreEqual(13, cols.GetColArray(4).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(5).IsSetHidden());
- Assert.AreEqual(false, cols.GetColArray(5).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(5).IsSetHidden());
+ Assert.IsFalse(cols.GetColArray(5).IsSetCollapsed());
Assert.AreEqual(14, cols.GetColArray(5).min); // 1 based
Assert.AreEqual(14, cols.GetColArray(5).max); // 1 based
@@ -619,9 +619,9 @@ public void TestSetColumnGroupCollapsed()
//expand - 3
sheet1.SetColumnGroupCollapsed((short)10, false);
Assert.AreEqual(6, cols.sizeOfColArray());
- Assert.AreEqual(false, cols.GetColArray(0).hidden);
- Assert.AreEqual(false, cols.GetColArray(5).hidden);
- Assert.AreEqual(false, cols.GetColArray(4).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(0).hidden);
+ Assert.IsFalse(cols.GetColArray(5).hidden);
+ Assert.IsFalse(cols.GetColArray(4).IsSetCollapsed());
// write out and give back
// Save and re-load
@@ -630,28 +630,28 @@ public void TestSetColumnGroupCollapsed()
sheet1 = (XSSFSheet)wb2.GetSheetAt(0);
Assert.AreEqual(6, cols.sizeOfColArray());
- Assert.AreEqual(false, cols.GetColArray(0).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(0).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(0).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(0).IsSetCollapsed());
Assert.AreEqual(5, cols.GetColArray(0).min); // 1 based
Assert.AreEqual(8, cols.GetColArray(0).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(1).IsSetHidden());
- Assert.AreEqual(false, cols.GetColArray(1).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(1).IsSetHidden());
+ Assert.IsFalse(cols.GetColArray(1).IsSetCollapsed());
Assert.AreEqual(9, cols.GetColArray(1).min); // 1 based
Assert.AreEqual(9, cols.GetColArray(1).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(2).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(2).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(2).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(2).IsSetCollapsed());
Assert.AreEqual(10, cols.GetColArray(2).min); // 1 based
Assert.AreEqual(10, cols.GetColArray(2).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(3).IsSetHidden());
- Assert.AreEqual(true, cols.GetColArray(3).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(3).IsSetHidden());
+ Assert.IsTrue(cols.GetColArray(3).IsSetCollapsed());
Assert.AreEqual(11, cols.GetColArray(3).min); // 1 based
Assert.AreEqual(12, cols.GetColArray(3).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(4).IsSetHidden());
- Assert.AreEqual(false, cols.GetColArray(4).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(4).IsSetHidden());
+ Assert.IsFalse(cols.GetColArray(4).IsSetCollapsed());
Assert.AreEqual(13, cols.GetColArray(4).min); // 1 based
Assert.AreEqual(13, cols.GetColArray(4).max); // 1 based
- Assert.AreEqual(false, cols.GetColArray(5).IsSetHidden());
- Assert.AreEqual(false, cols.GetColArray(5).IsSetCollapsed());
+ Assert.IsFalse(cols.GetColArray(5).IsSetHidden());
+ Assert.IsFalse(cols.GetColArray(5).IsSetCollapsed());
Assert.AreEqual(14, cols.GetColArray(5).min); // 1 based
Assert.AreEqual(14, cols.GetColArray(5).max); // 1 based
@@ -675,68 +675,68 @@ public void TestSetRowGroupCollapsed()
sheet1.GroupRow(16, 19);
Assert.AreEqual(14, sheet1.PhysicalNumberOfRows);
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetHidden());
//collapsed
sheet1.SetRowGroupCollapsed(7, true);
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(true, ((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(true, ((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(true, ((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetCollapsed());
+ Assert.IsTrue(((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetCollapsed());
+ Assert.IsTrue(((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetCollapsed());
+ Assert.IsTrue(((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetHidden());
//expanded
sheet1.SetRowGroupCollapsed(7, false);
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(true, ((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(true, ((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(true, ((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetCollapsed());
+ Assert.IsTrue(((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetCollapsed());
+ Assert.IsTrue(((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetCollapsed());
+ Assert.IsTrue(((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetHidden());
// Save and re-load
XSSFWorkbook wb2 = XSSFTestDataSamples.WriteOutAndReadBack(wb1);
sheet1 = (XSSFSheet)wb2.GetSheetAt(0);
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(true, ((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(true, ((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(true, ((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetHidden());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetCollapsed());
- Assert.AreEqual(false, ((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(6)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetCollapsed());
+ Assert.IsTrue(((XSSFRow)sheet1.GetRow(7)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetCollapsed());
+ Assert.IsTrue(((XSSFRow)sheet1.GetRow(9)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetCollapsed());
+ Assert.IsTrue(((XSSFRow)sheet1.GetRow(14)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(16)).GetCTRow().IsSetHidden());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetCollapsed());
+ Assert.IsFalse(((XSSFRow)sheet1.GetRow(18)).GetCTRow().IsSetHidden());
wb2.Close();
}
@@ -1071,7 +1071,7 @@ public void TestSetAutoFilter()
Assert.IsNotNull(nm);
Assert.AreEqual(0u, nm.GetCTName().localSheetId);
- Assert.AreEqual(true, nm.GetCTName().hidden);
+ Assert.IsTrue(nm.GetCTName().hidden);
Assert.AreEqual("_xlnm._FilterDatabase", nm.GetCTName().name);
Assert.AreEqual("'new sheet'!$A$1:$D$100", nm.GetCTName().Value);
@@ -1211,7 +1211,7 @@ public void TestSetForceFormulaRecalculation()
// Set
sheet.ForceFormulaRecalculation = (true);
- Assert.AreEqual(true, sheet.ForceFormulaRecalculation);
+ Assert.IsTrue(sheet.ForceFormulaRecalculation);
// calcMode="manual" is unset when forceFormulaRecalculation=true
CT_CalcPr calcPr = wb1.GetCTWorkbook().AddNewCalcPr();
@@ -1221,7 +1221,7 @@ public void TestSetForceFormulaRecalculation()
// Check
sheet.ForceFormulaRecalculation = (false);
- Assert.AreEqual(false, sheet.ForceFormulaRecalculation);
+ Assert.IsFalse(sheet.ForceFormulaRecalculation);
// Save, re-load, and re-check
@@ -1229,7 +1229,7 @@ public void TestSetForceFormulaRecalculation()
wb1.Close();
sheet = (XSSFSheet)wb2.GetSheet("Sheet 1");
- Assert.AreEqual(false, sheet.ForceFormulaRecalculation);
+ Assert.IsFalse(sheet.ForceFormulaRecalculation);
wb2.Close();
}
@@ -1563,7 +1563,7 @@ protected void testCopyOneRow(String copyRowsTestWorkbook)
// Boolean
cell = CellUtil.GetCell(destRow, col++);
Assert.AreEqual(CellType.Boolean, cell.CellType, "[Boolean] F7 cell type");
- Assert.AreEqual(true, cell.BooleanCellValue, "[Boolean] F7 cell value");
+ Assert.IsTrue(cell.BooleanCellValue, "[Boolean] F7 cell value");
// String
cell = CellUtil.GetCell(destRow, col++);
Assert.AreEqual(CellType.String, cell.CellType, "[String] G7 cell type");
@@ -1731,15 +1731,14 @@ protected void testCopyMultipleRows(String copyRowsTestWorkbook)
col++;
cell = CellUtil.GetCell(destRow1, col);
Assert.AreEqual(CellType.Boolean, cell.CellType, "[Boolean] F10 cell type");
- Assert.AreEqual(true, cell.BooleanCellValue, "[Boolean] F10 cell value");
+ Assert.IsTrue(cell.BooleanCellValue, "[Boolean] F10 cell value");
cell = CellUtil.GetCell(destRow2, col);
Assert.AreEqual(CellType.Boolean, cell.CellType, "[Boolean] F11 cell type");
- Assert.AreEqual(false, cell.BooleanCellValue, "[Boolean] F11 cell value");
+ Assert.IsFalse(cell.BooleanCellValue, "[Boolean] F11 cell value");
// String
- col++;
- cell = CellUtil.GetCell(destRow1, col);
+ col++; cell = CellUtil.GetCell(destRow1, col);
Assert.AreEqual(CellType.String, cell.CellType, "[String] G10 cell type");
Assert.AreEqual("Hello", cell.StringCellValue, "[String] G10 cell value");