• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class ColumnCollection

Represents a collection of columns in a worksheet.

Inheritance
object
ColumnCollection
Implements
INotifyCollectionChanged
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class ColumnCollection : INotifyCollectionChanged
Remarks

Provides indexed access to columns and methods for bulk column operations.

Properties

this[int]

Gets a column by its zero-based index.

Declaration
public Column this[int index] { get; }
Parameters
Type Name Description
int index

The zero-based column index (0 to MaxIndex).

Property Value
Type Description
Column

The column at the specified index.

Remarks

Provides indexed access to columns and methods for bulk column operations.

Exceptions
Type Condition
ArgumentException

Thrown when the index is out of range.

this[string]

Gets a column by its label (letter designation).

Declaration
public Column this[string label] { get; }
Parameters
Type Name Description
string label

The column label (e.g., "A", "B", "AA").

Property Value
Type Description
Column

The column with the specified label.

Remarks

Provides indexed access to columns and methods for bulk column operations.

Width

Sets the default width applied to columns on the worksheet.

Declaration
public double Width { set; }
Property Value
Type Description
double
Remarks

Provides indexed access to columns and methods for bulk column operations.

Methods

Autofit()

Autofit all columns on a worksheet.

Declaration
public void Autofit()
Remarks

Provides indexed access to columns and methods for bulk column operations.

Delete(int)

Deletes a column at the specified index.

Declaration
public void Delete(int index)
Parameters
Type Name Description
int index

The zero-based index of the column to delete.

Remarks

Provides indexed access to columns and methods for bulk column operations.

GetAllColumns()

Gets all columns in the worksheet.

Declaration
public IEnumerable<Column> GetAllColumns()
Returns
Type Description
IEnumerable<Column>

An enumerable of all columns.

Remarks

Provides indexed access to columns and methods for bulk column operations.

GetColumnIndexAtXPixels(double)

Gets the column index at a given X pixel coordinate.

Declaration
public int GetColumnIndexAtXPixels(double y)
Parameters
Type Name Description
double y

The X pixel coordinate (horizontal position).

Returns
Type Description
int

The zero-based column index at that position.

Remarks

Provides indexed access to columns and methods for bulk column operations.

Exceptions
Type Condition
ArgumentException

Thrown when the coordinate is invalid.

GetModifiedColumns()

Gets only the columns that have been modified from their defaults.

Declaration
public IEnumerable<Column> GetModifiedColumns()
Returns
Type Description
IEnumerable<Column>

An enumerable of modified columns.

Remarks

Provides indexed access to columns and methods for bulk column operations.

Group(int, int, bool)

Groups a range of columns together with optional collapse.

Declaration
public void Group(int fromIndex, int toIndex, bool collapse)
Parameters
Type Name Description
int fromIndex

The starting column index.

int toIndex

The ending column index.

bool collapse

Whether to collapse the group.

Remarks

Provides indexed access to columns and methods for bulk column operations.

Hide(int, int)

Hides a range of columns.

Declaration
public void Hide(int fromIndex, int toIndex)
Parameters
Type Name Description
int fromIndex

The starting column index.

int toIndex

The ending column index.

Remarks

Provides indexed access to columns and methods for bulk column operations.

Insert(int)

Inserts a new column at the specified index.

Declaration
public void Insert(int index)
Parameters
Type Name Description
int index

The zero-based index where the column will be inserted.

Remarks

Provides indexed access to columns and methods for bulk column operations.

SetWidthCharacters(int, int, double)

Sets the width for a range of columns.

Declaration
public void SetWidthCharacters(int fromIndex, int toIndex, double width)
Parameters
Type Name Description
int fromIndex

The starting column index.

int toIndex

The ending column index.

double width

The width in characters.

Remarks

Provides indexed access to columns and methods for bulk column operations.

SetWidthCharacters(string, string, double)

Sets the width for a range of columns by label.

Declaration
public void SetWidthCharacters(string fromLabel, string toLabel, double width)
Parameters
Type Name Description
string fromLabel

The starting column label (e.g., "A").

string toLabel

The ending column label (e.g., "D").

double width

The width in characters.

Remarks

Provides indexed access to columns and methods for bulk column operations.

Ungroup(int, int)

Ungroups a range of columns.

Declaration
public void Ungroup(int fromIndex, int toIndex)
Parameters
Type Name Description
int fromIndex

The starting column index.

int toIndex

The ending column index.

Remarks

Provides indexed access to columns and methods for bulk column operations.

Events

CollectionChanged

Occurs when the collection changes.

Declaration
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Type
Type Description
NotifyCollectionChangedEventHandler
Remarks

Provides indexed access to columns and methods for bulk column operations.

Implements

INotifyCollectionChanged
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX