Forums     Knowledge Base     OfficeWriter Online     
 
This documentation is for
OfficeWriter v3.0.4
.NET Platform

View Docs for Another
Version or Platform

Programmer's Reference > ExcelApplication API > Cell

The Cell Object


A Cell object represents a single cell in a worksheet. To return a Cell object use Worksheet.Cells. Specify the cell by 0-based row and column indexes or by Excel-style reference:



Examples:

[csharp]
// Get Cell by Excel-style reference
ExcelApplication xla = new ExcelApplication();
Workbook wb = xla.Create();
Worksheet ws = wb.Worksheets[0];
Cell cellA1 = ws.Cells[0,0];

// Get Cell by Excel-style reference
ExcelApplication xla = new ExcelApplication();
Workbook wb = xla.Create();
Worksheet ws = wb.Worksheets[0];
Cell cellA1 = ws.Cells["A1"];
[vbnet]
// Get Cell by Excel-style reference
Dim xla As New ExcelApplication()
Dim wb As Workbook = xla.Create()
Dim ws As Worksheet = wb.Worksheets(0)
Dim cellA1 As Cell = ws.Cells(0, 0)

// Get Cell by Excel-style reference
Dim xla As New ExcelApplication()
Dim wb As Workbook = xla.Create()
Dim ws As Worksheet = wb.Worksheets(0)
Dim cellA1 As Cell = ws.Cells("A1")


Cell Enumerations

NameDescription
Cell.CellValueType

A CellValueType value specifies the data type of the cell's value.



Cell Properties

Property Type Access Description
ColumnNumber int read

Returns the cell's 0-based column number

Comment Comment read

Returns a Comment object representing a note attached to the cell, separate from other cell content

Formula String read
write

Sets or returns a cell formula

HasComment boolean read

Returns true if a Comment object is associated with the cell

Name String read

Returns the cell's Excel-style name (such as, "B5")

RowNumber int read

Returns the cell's 0-based row number

Style Style read
write

Sets or returns a Style object that determines how the cell looks, including number format, font, orientation, etc

Value Object read
write

Sets or returns a cell value

ValueType CellValueType read

Returns the data type of the cell's value: "Blank, "Boolean", "Date", "Error", "Numeric", or "Text"



Cell Methods

ReturnsSignature and Description
void ApplyStyle ( Style style )

Applies a style to the cell

void ClearContent ( )

Clears a cell's content

void ClearRichTextFormatting ( )

Clears all rich text formatting within the cell

Anchor CreateAnchor ( int percentX , int percentY )

Creates an anchor within the specified cell

Hyperlink CreateHyperlink ( String href )

Creates a new hyperlink in the cell pointing to the specified href

CharacterRun GetCharacters ( int startIndex )

Returns a CharacterRun object representing a range of characters within the cell

CharacterRun GetCharacters ( int startIndex , int length )

Returns a CharacterRun object representing a range of characters within the cell

void RemoveComment ( )

Removes the comment associated with the cell



Copyright 2005 © SoftArtisans, Inc. All Rights Reserved.