AnchorCell Class
Represents an anchor cell object used in ExcelDrawingPosition type to specify from which cell and to which cell drawing (picture, chart, etc.) spans.
public sealed class AnchorCell : IEquatable<AnchorCell>
Public NotInheritable Class AnchorCell
Implements IEquatable(Of AnchorCell)
- Inheritance:
- System.ObjectAnchorCell
Implements
Constructors
AnchorCell(AnchorCell)
Initializes a new instance of the AnchorCell class by using another anchor cell.
Parameters
anchorCell
- AnchorCell
Anchor cell to copy from.
Exceptions
- System.ArgumentNullException
anchorCell
is null.
AnchorCell(ExcelCell, Boolean)
Initializes a new instance of the AnchorCell class.
public AnchorCell(ExcelCell cell, bool topLeft)
Public Sub New(cell As ExcelCell, topLeft As Boolean)
Parameters
cell
- ExcelCell
The cell where the anchor is placed.
topLeft
- System.Boolean
If set to true, anchor will be placed in the top left corner of the cell in current column and current row; otherwise, anchor will be placed in the top-left corner of the cell in next column and next row.
AnchorCell(ExcelColumn, ExcelRow, Boolean)
Initializes a new instance of the AnchorCell class.
public AnchorCell(ExcelColumn column, ExcelRow row, bool topLeft)
Public Sub New(column As ExcelColumn, row As ExcelRow, topLeft As Boolean)
Parameters
column
- ExcelColumn
The column where the anchor is placed.
row
- ExcelRow
The row where the anchor is placed.
topLeft
- System.Boolean
If set to true, anchor will be placed in the top left corner of the cell in current column and current row; otherwise, anchor will be placed in the top-left corner of the cell in next column and next row.
AnchorCell(ExcelColumn, ExcelRow, Double, Double, LengthUnit)
Initializes a new instance of the AnchorCell class by using offset values in arbitrary length unit.
public AnchorCell(ExcelColumn column, ExcelRow row, double columnOffset, double rowOffset, LengthUnit unit)
Public Sub New(column As ExcelColumn, row As ExcelRow, columnOffset As Double, rowOffset As Double, unit As LengthUnit)
Parameters
column
- ExcelColumn
The column where the anchor is placed.
row
- ExcelRow
The row where the anchor is placed.
columnOffset
- System.Double
The column offset for the anchor in arbitrary length unit.
rowOffset
- System.Double
The row offset for the anchor in arbitrary length unit.
unit
- LengthUnit
The length unit in which columnOffset
and rowOffset
are specified.
Exceptions
- System.ArgumentNullException
column
or row
is null.
- System.ArgumentException
column
and row
do not belong to the same worksheet.
AnchorCell(ExcelColumn, ExcelRow, Int64, Int64)
Initializes a new instance of the AnchorCell class by using offset values in EMU units (1 point = 12 700 EMU).
public AnchorCell(ExcelColumn column, ExcelRow row, long columnOffset, long rowOffset)
Public Sub New(column As ExcelColumn, row As ExcelRow, columnOffset As Long, rowOffset As Long)
Parameters
column
- ExcelColumn
The column where the anchor is placed.
row
- ExcelRow
The row where the anchor is placed.
columnOffset
- System.Int64
The column offset for the anchor.
rowOffset
- System.Int64
The row offset for the anchor.
Exceptions
- System.ArgumentNullException
column
or row
is null.
- System.ArgumentException
column
and row
do not belong to the same worksheet.
Properties
Column
Gets or sets the column for the anchor cell.
Property Value
The column for the anchor cell.
Exceptions
- System.ArgumentNullException
Value is null.
- System.ArgumentException
Column doesn't belong to the same worksheet as anchor cell row.
ColumnOffset
Gets or sets the column offset for the anchor cell in EMU units (1 point = 12 700 EMU).
Property Value
- System.Int64
The column offset for the anchor cell in EMU units (1 point = 12 700 EMU).
Remarks
LengthUnit for this property is Emu (English Metric Unit) (1 point = 12 700 EMU) for historical reasons.
Use GetColumnOffset(LengthUnit) and SetColumnOffset(Double, LengthUnit) methods to get or set the ColumnOffset using arbitrary LengthUnit.
ColumnOffset is constrained to Column.Width.
Row
Gets or sets the row for the anchor cell.
Property Value
The row for the anchor cell.
Exceptions
- System.ArgumentNullException
Value is null.
- System.ArgumentException
Row doesn't belong to the same worksheet as anchor cell column.
RowOffset
Gets or sets row offset for the anchor cell in EMU units (1 point = 12 700 EMU).
Property Value
- System.Int64
The row offset for the anchor cell in EMU units (1 point = 12 700 EMU).
Remarks
LengthUnit for this property is Emu (English Metric Unit) (1 point = 12 700 EMU) for historical reasons.
Use GetRowOffset(LengthUnit) and SetRowOffset(Double, LengthUnit) methods to get or set the RowOffset using arbitrary LengthUnit.
Methods
Equals(AnchorCell)
Determines whether the other
AnchorCell is equal to this AnchorCell instance.
Parameters
other
- AnchorCell
The other anchor cell to compare with this anchor cell instance.
Returns
- System.Boolean
true if the other
AnchorCell is equal to this AnchorCell instance; otherwise, false.
Equals(Object)
Determines whether the specified System.Object is equal to this AnchorCell instance.
public override bool Equals(object obj)
Public Overrides Function Equals(obj As Object) As Boolean
Parameters
obj
- System.Object
The System.Object to compare with this anchor cell instance.
Returns
- System.Boolean
true if the specified System.Object is an AnchorCell and is equal to this AnchorCell instance; otherwise, false.
Overrides
GetColumnOffset(LengthUnit)
Gets the column offset for the anchor cell in arbitrary length unit.
public double GetColumnOffset(LengthUnit unit)
Public Function GetColumnOffset(unit As LengthUnit) As Double
Parameters
unit
- LengthUnit
The length unit in which to return column offset.
Returns
- System.Double
The column offset for the anchor cell in arbitrary length unit.
Remarks
ColumnOffset is constrained to Column.Width.
GetHashCode()
Returns a hash code for this AnchorCell instance.
Returns
- System.Int32
An integer value that specifies a hash value for this AnchorCell instance.
Overrides
GetRowOffset(LengthUnit)
Gets the row offset for the anchor cell in arbitrary length unit.
public double GetRowOffset(LengthUnit unit)
Public Function GetRowOffset(unit As LengthUnit) As Double
Parameters
unit
- LengthUnit
The length unit in which to return row offset.
Returns
- System.Double
The row offset for the anchor cell in arbitrary length unit.
Remarks
SetColumnOffset(Double, LengthUnit)
Sets the column offset for the anchor cell in arbitrary length unit.
public void SetColumnOffset(double value, LengthUnit unit)
Public Sub SetColumnOffset(value As Double, unit As LengthUnit)
Parameters
value
- System.Double
The column offset value.
unit
- LengthUnit
The length unit in which value
is specified.
SetRowOffset(Double, LengthUnit)
Sets the row offset for the anchor cell in arbitrary length unit.
public void SetRowOffset(double value, LengthUnit unit)
Public Sub SetRowOffset(value As Double, unit As LengthUnit)
Parameters
value
- System.Double
The row offset value.
unit
- LengthUnit
The length unit in which value
is specified.
ToString()
Returns a System.String that represents this AnchorCell instance.
Returns
- System.String
A System.String that represents this AnchorCell instance.
Overrides
Remarks
This method should be used primarily for debugging purposes and should be considered volatile (format of its return value might change in future versions).