Interface IWorksheet
public interface IWorksheet : ITabSheet, IExcelApplication
- Inherited Members
Properties
ActivePane
Identifier of pane with active cell cursor.
int ActivePane { get; set; }
Property Value
AllocatedRange
Returns a Range object that represents a cell or a range of cells.
IXLSRange AllocatedRange { get; }
Property Value
AutoFilters
Returns collection of worksheet's autofilters. Read-only.
IAutoFilters AutoFilters { get; }
Property Value
Cells
Returns all used cells in the worksheet. Read-only.
IXLSRange[] Cells { get; }
Property Value
CodeName
Name that is used by macros to access the workbook items.
string CodeName { get; set; }
Property Value
Columns
For a Worksheet object, returns an array of Range objects that represents all the columns on the specified worksheet. Read-only Range object.
IXLSRange[] Columns { get; }
Property Value
Comments
Comments collection.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Adding comments to a cell.
ICommentShape comment1 = worksheet.Range["A1"].AddComment();
ICommentShape comment2 = worksheet.Range["B1"].AddComment();
//Set comment text
comment1.Text = "Comment1";
comment2.Text = "Comment2";
//Check count
Console.Write(worksheet.Comments.Count);
//Save to file
workbook.SaveToFile("Comments.xlsx");
IComments Comments { get; }
Property Value
DefaultColumnWidth
Returns or sets the standard (default) width of all the columns in the
worksheet. Read/write Double.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Get column width
Console.Write(worksheet.DefaultColumnWidth);
//Set default width
worksheet.DefaultColumnWidth = 40;
//Save to file
workbook.SaveToFile("DefaultColumnWidth.xlsx");
double DefaultColumnWidth { get; set; }
Property Value
DefaultRowHeight
Returns the standard (default) height of all the rows in the worksheet,
in points. Read/write Double.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Get row height
Console.Write(worksheet.DefaultRowHeight);
//Set default height
worksheet.DefaultRowHeight = 40;
//Save to file
workbook.SaveToFile("DefaultRowHeight.xlsx");
double DefaultRowHeight { get; set; }
Property Value
DisplayPageBreaks
True if page breaks (both automatic and manual) on the specified worksheet are displayed. Read / write Boolean.
bool DisplayPageBreaks { get; set; }
Property Value
FirstVisibleColumn
Index to first visible column in right pane(s).
int FirstVisibleColumn { get; set; }
Property Value
FirstVisibleRow
Index to first visible row in bottom pane(s).
int FirstVisibleRow { get; set; }
Property Value
FormulasVisible
bool FormulasVisible { get; set; }
Property Value
GridLineColor
Gets / sets Grid line color.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set grid lines color
worksheet.GridLineColor = ExcelColors.Red;
//Save to file
workbook.SaveToFile("GridLineColor.xlsx");
ExcelColors GridLineColor { get; set; }
Property Value
GridLinesVisible
True if gridlines are visible;
False otherwise.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set grid line visibility
worksheet.GridLinesVisible = false;
//Save to file
workbook.SaveToFile("GridLinesVisible.xlsx");
bool GridLinesVisible { get; set; }
Property Value
HPageBreaks
Returns an HPageBreaks collection that represents the horizontal page breaks on the sheet. Read-only.
IHPageBreaks HPageBreaks { get; }
Property Value
HasOleObjects
Gets or sets a value indicating whether this instance is OLE object.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create image stream
System.Drawing.Image image = System.Drawing.Image.FromFile("image.png");
//Add ole object
IOleObject oleObject = worksheet.OleObjects.Add("Shapes.xlsx", image, OleLinkType.Embed);
//Check HasOleObject.Output will be true.
Console.Write(worksheet.HasOleObjects);
//Save to file
workbook.SaveToFile("HasOleObjects.xlsx");
bool HasOleObjects { get; }
Property Value
- bool
true
if this instance is OLE object; otherwise,false
.
HorizontalSplit
Gets or sets the position of horizontal split in the worksheet.
int HorizontalSplit { get; set; }
Property Value
Remarks
Position of the horizontal split (by, 0 = No horizontal split): Unfrozen pane: Height of the top pane(s) (in twips = 1/20 of a point) Frozen pane: Number of visible rows in top pane(s)
HyperLinks
Collection of all worksheet's hyperlinks.
IHyperLinks HyperLinks { get; }
Property Value
Index
Returns the index number of the object within the collection of similar objects. Read-only.
int Index { get; }
Property Value
IsDisplayZeros
True if zero values to be displayed False otherwise.
bool IsDisplayZeros { get; set; }
Property Value
IsStringsPreserved
Indicates if all values in the workbook are preserved as strings.
bool IsStringsPreserved { get; set; }
Property Value
this[int, int]
Gets / sets cell by row and index.
IXLSRange this[int row, int column] { get; }
Parameters
Property Value
this[int, int, int, int]
Get cells range.
IXLSRange this[int row, int column, int lastRow, int lastColumn] { get; }
Parameters
Property Value
this[string]
Get cell range.
IXLSRange this[string name] { get; }
Parameters
name
string
Property Value
LeftVisibleColumn
Gets/sets left visible column of the worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set left visible column
worksheet.LeftVisibleColumn = 3;
//Get left visible column
Console.Write(worksheet.LeftVisibleColumn);
//Save to file
workbook.SaveToFile("LeftVisibleColumn.xlsx");
int LeftVisibleColumn { get; set; }
Property Value
ListObjects
Gets collection of all list objects in the worksheet.
IListObjects ListObjects { get; }
Property Value
MergedCells
Returns all merged ranges. Read-only.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Merge cells
worksheet["C2:D2"].Merge();
worksheet["F3:G3"].Merge();
//Get merged ranges
IXLSRange[] mergedRanges = worksheet.MergedCells;
//Get merged range count . Output will be 2
Console.Write(mergedRanges.Length);
//Save to file
workbook.SaveToFile("MergedCells.xlsx");
IXLSRange[] MergedCells { get; }
Property Value
Names
For a Worksheet object, returns a Names collection that represents all the worksheet-specific names (names defined with the "WorksheetName!" prefix). Read-only Names object.
INameRanges Names { get; }
Property Value
OleObjects
Gets the OLE objects.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create image stream
System.Drawing.Image image = System.Drawing.Image.FromFile("image.png");
//Add ole object
IOleObject oleObject = worksheet.OleObjects.Add("Shapes.xlsx", image, OleLinkType.Embed);
//Save to file
workbook.SaveToFile("OLEObjects.xlsx");
IOleObjects OleObjects { get; }
Property Value
- IOleObjects
The OLE objects.
PageSetup
Returns a PageSetup object that contains all the page setup settings for the specified object. Read-only.
IPageSetup PageSetup { get; }
Property Value
PivotTables
Returns pivot table collection containing all pivot tables in the worksheet. Read-only.
PivotTablesCollection PivotTables { get; }
Property Value
Range
Returns a Range object that represents the used range on the
specified worksheet. Read-only.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set text
worksheet["B2"].Text = "Text";
//Set Color
worksheet["J3"].Style.Color = Color.Red;
//Get used range . Output will be B2:J3
Console.Write(worksheet.Range.RangeAddressLocal);
//Save to file
workbook.SaveToFile("UsedRange.xlsx");
XlsRange Range { get; }
Property Value
RowColumnHeadersVisible
True if row and column headers are visible; False otherwise.
bool RowColumnHeadersVisible { get; set; }
Property Value
Rows
For a Worksheet object, returns an array of Range objects that represents all the rows on the specified worksheet. Read-only Range object.
IXLSRange[] Rows { get; }
Property Value
TopVisibleRow
Gets/sets top visible row of the worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set top visible row
worksheet.TopVisibleRow = 5;
//Get top visible row
Console.Write(worksheet.TopVisibleRow);
//Save to file
workbook.SaveToFile("TopVisibleRow.xlsx");
int TopVisibleRow { get; set; }
Property Value
Type
Returns or sets the worksheet type. Read-only ExcelSheetType.
ExcelSheetType Type { get; }
Property Value
UseRangesCache
Indicates whether all created range objects should be cached. Default value is false.
bool UseRangesCache { get; set; }
Property Value
VPageBreaks
Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.
IVPageBreaks VPageBreaks { get; }
Property Value
VerticalSplit
Gets or sets the position of vertical split in the worksheet.
int VerticalSplit { get; set; }
Property Value
Remarks
Position of the vertical split (px, 0 = No vertical split): Unfrozen pane: Width of the left pane(s) (in twips = 1/20 of a point) Frozen pane: Number of visible columns in left pane(s)
Zoom
Zoom factor of document. Value must be in range from 10 till 400.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set zoom
worksheet.Zoom = 200;
//Save to file
workbook.SaveToFile("Zoom.xlsx");
int Zoom { get; set; }
Property Value
Methods
AutoFitColumn(int)
Autofits specified column.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set text
worksheet["A1"].Text = "Sample text in cell";
//Set auto fit
worksheet.AutoFitColumn(1);
//Save to file
workbook.SaveToFile("AutoFitColumn.xlsx");
void AutoFitColumn(int columnIndex)
Parameters
columnIndex
intOne-based column index.
AutoFitRow(int)
Autofits specified row.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set text
worksheet["C2"].Value = "Sample text";
//Set Style
CellStyle style = workbook.Styles.Add("CustomStyle");
IFont font = style.Font;
font.Size = 18;
worksheet["C2"].Style = style;
//Set auto fit
worksheet.AutoFitRow(2);
//Save to file
workbook.SaveToFile("AutoFitRow.xlsx");
void AutoFitRow(int rowIndex)
Parameters
rowIndex
intOne-based row index.
CheckExistence(int, int)
Indicates whether a cell was initialized or accessed by the user.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set text
worksheet.Range["A1"].Text = "Hello";
//Check the cell.Output will be true.
Console.Write(worksheet.CheckExistence(1, 1));
//Save to file
workbook.SaveToFile("CheckExistence.xlsx");
bool CheckExistence(int iRow, int iColumn)
Parameters
Returns
- bool
Value indicating whether the cell was initialized or accessed by the user.
Clear()
Clears worksheet data. Removes all formatting and merges.
void Clear()
ClearData()
Clears worksheet. Only the data is removed from each cell.
void ClearData()
ColumnWidthToPixels(double)
Converts column width into pixels.
int ColumnWidthToPixels(double widthInChars)
Parameters
widthInChars
doubleWidth in characters.
Returns
- int
Width in pixels
CreateNamedRanges(string, string, bool)
void CreateNamedRanges(string namedRange, string referRange, bool vertical)
Parameters
DeleteColumn(int)
Removes specified column (with formulas update).
void DeleteColumn(int index)
Parameters
index
intOne-based column index to remove.
DeleteRow(int)
Removes specified row (with formulas update).
void DeleteRow(int index)
Parameters
index
intOne-based row index to remove.
GetBoolean(int, int)
Gets bool value from cell.
bool GetBoolean(int row, int column)
Parameters
Returns
- bool
Returns found bool value. If cannot found returns false.
GetColumnWidthPixels(int)
Returns width in pixels from ColumnInfoRecord if there is corresponding ColumnInfoRecord
or StandardWidth if not.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set text
worksheet["A1"].Text = "Sample text in cell";
//Set auto fit
worksheet.AutoFitColumn(1);
//Get column width
Console.WriteLine(worksheet.GetColumnWidthPixels(1));
//Save to file
workbook.SaveToFile("UsedRange.xlsx");
int GetColumnWidthPixels(int Column)
Parameters
Column
intOne-based index of the column.
Returns
- int
Width in pixels of the specified column.
GetDefaultColumnStyle(int)
Returns default column style.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create style
CellStyle style = workbook.Styles.Add("CustomStyle");
//Set Color
style.Color = Color.Red;
//Set default style
worksheet.SetDefaultColumnStyle(2,style);
//Get default style
CellStyle defaultStyle = worksheet.GetDefaultColumnStyle(2);
//Set color
defaultStyle.Color = Color.Blue;
worksheet.SetDefaultColumnStyle(3, defaultStyle);
//Save to file
workbook.SaveToFile("GetDefaultColumnStyle.xlsx");
IStyle GetDefaultColumnStyle(int iColumnIndex)
Parameters
iColumnIndex
intColumn index.
Returns
- IStyle
Default column style or null if style wasn't set.
GetDefaultRowStyle(int)
Returns default row style.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create style
CellStyle style = workbook.Styles.Add("CustomStyle");
//Set Color
style.Color = Color.Red;
//Set default style
worksheet.SetDefaultRowStyle(2,style);
//Get default style
CellStyle defaultStyle = worksheet.GetDefaultRowStyle(2);
//Set color
defaultStyle.Color = Color.Blue;
worksheet.SetDefaultRowStyle(3, defaultStyle);
//Save to file
workbook.SaveToFile("GetDefaultColumnStyle.xlsx");
IStyle GetDefaultRowStyle(int rowIndex)
Parameters
rowIndex
intRow index.
Returns
- IStyle
Default row style or null if style wasn't set.
GetError(int, int)
Gets error value from cell.
string GetError(int row, int column)
Parameters
Returns
- string
Returns error value or null.
GetFormula(int, int, bool)
Returns formula value corresponding to the cell.
string GetFormula(int row, int column, bool bR1C1)
Parameters
row
intOne-based row index of the cell to get value from.
column
intOne-based column index of the cell to get value from.
bR1C1
boolIndicates whether R1C1 notation should be used.
Returns
- string
Formula contained by the cell.
GetFormulaBoolValue(int, int)
Gets formula bool value from cell.
bool GetFormulaBoolValue(int row, int column)
Parameters
Returns
- bool
Returns found bool value. If cannot found returns false.
GetFormulaErrorValue(int, int)
Gets formula error value from cell.
string GetFormulaErrorValue(int row, int column)
Parameters
Returns
- string
Returns error value or null.
GetFormulaNumberValue(int, int)
Returns formula number value corresponding to the cell.
double GetFormulaNumberValue(int row, int column)
Parameters
row
intOne-based row index of the cell to get value from.
column
intOne-based column index of the cell to get value from.
Returns
- double
Number contained by the cell.
GetFormulaStringValue(int, int)
Returns formula string value corresponding to the cell.
string GetFormulaStringValue(int row, int column)
Parameters
row
intOne-based row index of the cell to get value from.
column
intOne-based column index of the cell to get value from.
Returns
- string
String contained by the cell.
GetNumber(int, int)
Returns number value corresponding to the cell.
double GetNumber(int row, int column)
Parameters
row
intOne-based row index of the cell to get value from.
column
intOne-based column index of the cell to get value from.
Returns
- double
Number contained by the cell.
GetRowHeightPixels(int)
Returns height from RowRecord if there is a corresponding RowRecord.
Otherwise returns StandardHeight.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set text
worksheet["C2"].Text = "Sample text";
worksheet["C2"].Style.Font.Size = 18;
//Set auto fit
worksheet.AutoFitRow(2);
//Get row height
Console.WriteLine(worksheet.GetRowHeightPixels(2));
//Save to file
workbook.SaveToFile("UsedRange.xlsx");
int GetRowHeightPixels(int Row)
Parameters
Row
intOne-bazed index of the row.
Returns
- int
Height in pixels from RowRecord if there is corresponding RowRecord. Otherwise returns StandardHeight.
GetText(int, int)
Returns string value corresponding to the cell.
string GetText(int row, int column)
Parameters
row
intOne-based row index of the cell to get value from.
column
intOne-based column index of the cell to get value from.
Returns
- string
String contained by the cell.
InsertArray(DateTime[], int, int, bool)
Imports an array of DateTimes into worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Initialize the DateTime Array
DateTime[] arrayDate = new DateTime[4] { DateTime.Parse("06:45"), DateTime.Parse("08:30"), DateTime.Parse("09:40"), DateTime.Parse("10:30") };
//Insert the DateTime Array to Sheet
worksheet.InsertArray(arrayDate, 1, 1, true);
//Save to file
workbook.SaveToFile(InsertArray.xlsx");
int InsertArray(DateTime[] arrDateTime, int firstRow, int firstColumn, bool isVertical)
Parameters
arrDateTime
DateTime[]Array to import.
firstRow
intRow of the first cell where array should be imported.
firstColumn
intColumn of the first cell where array should be imported.
isVertical
boolTrue if array should be imported vertically; False - horizontally.
Returns
- int
Number of imported elements.
InsertArray(double[], int, int, bool)
Imports an array of doubles into a worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Initialize the double Array
double[] arrayDouble = new double[4] { 344.0045, 345.0045, 346.0045, 347.0045 };
//Insert the double Array to Sheet
worksheet.InsertArray(arrayDouble, 1, 1, true);
//Save to file
workbook.SaveToFile(InsertArray.xlsx");
int InsertArray(double[] arrDouble, int firstRow, int firstColumn, bool isVertical)
Parameters
arrDouble
double[]Array to import.
firstRow
intRow of the first cell where array should be imported.
firstColumn
intColumn of the first cell where array should be imported.
isVertical
boolTrue if array should be imported vertically; False - horizontally.
Returns
- int
Number of imported elements.
InsertArray(int[], int, int, bool)
Imports an array of integers into a worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Initialize the integer Array
int[] arrayInt = new int[4] {1000, 2000, 3000, 4000};
//Insert the integer Array to Sheet
worksheet.InsertArray(arrayInt, 1, 1, true);
//Save to file
workbook.SaveToFile(InsertArray.xlsx");
int InsertArray(int[] arrInt, int firstRow, int firstColumn, bool isVertical)
Parameters
arrInt
int[]Array to import.
firstRow
intRow of the first cell where array should be imported.
firstColumn
intColumn of the first cell where array should be imported.
isVertical
boolTrue if array should be imported vertically; False - horizontally.
Returns
- int
Number of imported elements.
InsertArray(object[,], int, int)
Imports an array of objects into a worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Initialize the Object Array
object[,] arrayTwoDimen = new object[3, 2] { { "AND", "OR" }, { "NAND", "XOR" },{ "NOR", "NOT" } };
//Insert the Object Array to Sheet
worksheet.InsertArray(arrayTwoDimen, 1, 1);
//Save to file
workbook.SaveToFile(InsertArray.xlsx");
int InsertArray(object[,] arrObject, int firstRow, int firstColumn)
Parameters
arrObject
object[,]Array to import.
firstRow
intRow of the first cell where array should be imported.
firstColumn
intColumn of the first cell where array should be imported.
Returns
- int
Number of imported rows.
InsertArray(object[], int, int, bool)
Imports an array of objects into a worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Initialize the Object Array
object[] array = new object[4] { "Total Income", "Actual Expense", "Expected Expenses", "Profit" };
//Insert the Object Array to Sheet
worksheet.InsertArray(array, 1, 1, true);
//Save to file
workbook.SaveToFile(InsertArray.xlsx");
int InsertArray(object[] arrObject, int firstRow, int firstColumn, bool isVertical)
Parameters
arrObject
object[]Array to import.
firstRow
intRow of the first cell where array should be imported.
firstColumn
intColumn of the first cell where array should be imported.
isVertical
boolTrue if array should be imported vertically; False - horizontally.
Returns
- int
Number of imported elements.
InsertArray(string[], int, int, bool)
Imports an array of strings into a worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Initialize the string Array
string[] arrayString = new string[4] { "Total Income", "Actual Expense", "Expected Expenses", "Profit" };
//Insert the string Array to Sheet
worksheet.InsertArray(arrayString, 1, 1, true);
//Save to file
workbook.SaveToFile(InsertArray.xlsx");
int InsertArray(string[] arrString, int firstRow, int firstColumn, bool isVertical)
Parameters
arrString
string[]Array to import.
firstRow
intRow of the first cell where array should be imported.
firstColumn
intColumn of the first cell where array should be imported.
isVertical
boolTrue if array should be imported vertically; False - horizontally.
Returns
- int
Number of imported elements.
InsertDataColumn(DataColumn, bool, int, int)
Imports data from a DataColumn into worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create a DataTable
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Item", typeof(string));
table.Columns.Add("Name", typeof(string));
table.Rows.Add(1, "Soap", "David");
table.Rows.Add(2, "Paste", "Sam");
table.Rows.Add(3, "Cream", "Christoff");
//Insert the DataColumn to worksheet
System.Data.DataColumn column = table.Columns[2];
worksheet.InsertDataColumn(column, true, 1, 1);
//Save to file
workbook.SaveToFile(InsertDataColumn.xlsx");
int InsertDataColumn(DataColumn dataColumn, bool isFieldNameShown, int firstRow, int firstColumn)
Parameters
dataColumn
DataColumnDataColumn with desired data.
isFieldNameShown
boolTrue if column name must also be imported.
firstRow
intRow of the first cell where DataTable should be imported.
firstColumn
intColumn of the first cell where DataTable should be imported.
Returns
- int
Number of imported rows.
InsertDataTable(DataTable, bool, int, int)
Imports data from a DataTable into worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create a DataTable
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Item", typeof(string));
table.Columns.Add("Name", typeof(string));
table.Rows.Add(1, "Soap", "David");
table.Rows.Add(2, "Paste", "Sam");
table.Rows.Add(3, "Cream", "Christoff");
//Insert the DataTable to worksheet
worksheet.InsertDataTable(table, true, 1, 1);
//Save to file
workbook.SaveToFile(InsertDataTable.xlsx");
int InsertDataTable(DataTable dataTable, bool isFieldNameShown, int firstRow, int firstColumn)
Parameters
dataTable
DataTableDataTable with desired data.
isFieldNameShown
boolTrue if column names must also be imported.
firstRow
intRow of the first cell where DataTable should be imported.
firstColumn
intColumn of the first cell where DataTable should be imported.
Returns
- int
Number of imported rows.
InsertDataTable(DataTable, bool, int, int, bool)
Imports data from a DataTable into worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create a DataTable
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Item", typeof(string));
table.Columns.Add("Name", typeof(string));
table.Rows.Add(1, "Soap", "David");
table.Rows.Add(2, "Paste", "Sam");
table.Rows.Add(3, "Cream", "Christoff");
//Insert the DataTable to worksheet
worksheet.InsertDataTable(table, true, 1, 1 , true);
//Save to file
workbook.SaveToFile(InsertDataTable.xlsx");
int InsertDataTable(DataTable dataTable, bool isFieldNameShown, int firstRow, int firstColumn, bool preserveTypes)
Parameters
dataTable
DataTableDataTable with desired data.
isFieldNameShown
boolTrue if column names must also be imported.
firstRow
intRow of the first cell where DataTable should be imported.
firstColumn
intColumn of the first cell where DataTable should be imported.
preserveTypes
boolIndicates whether XlsIO should try to preserve types in DataTable, i.e. if it is set to False (default) and in DataTable we have in string column value that contains only numbers, it would be converted to number.
Returns
- int
Number of imported rows.
InsertDataTable(DataTable, bool, int, int, int, int)
Imports data from a DataTable into worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create a DataTable
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Item", typeof(string));
table.Columns.Add("Name", typeof(string));
table.Rows.Add(1, "Soap", "David");
table.Rows.Add(2, "Paste", "Sam");
table.Rows.Add(3, "Cream", "Christoff");
//Insert the DataTable to worksheet
worksheet.InsertDataTable(table, true, 1 , 1 , 2 , 2);
//Save to file
workbook.SaveToFile(InsertDataTable.xlsx");
int InsertDataTable(DataTable dataTable, bool isFieldNameShown, int firstRow, int firstColumn, int maxRows, int maxColumns)
Parameters
dataTable
DataTableDataTable with desired data.
isFieldNameShown
boolTrue if column names must also be imported.
firstRow
intRow of the first cell where DataTable should be imported.
firstColumn
intColumn of the first cell where DataTable should be imported.
maxRows
intMaximum number of rows to import.
maxColumns
intMaximum number of columns to import.
Returns
- int
Number of imported rows.
InsertDataTable(DataTable, bool, int, int, int, int, bool)
Imports data from a DataTable into worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create a DataTable
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Item", typeof(string));
table.Columns.Add("Name", typeof(string));
table.Rows.Add(1, "Soap", "David");
table.Rows.Add(2, "Paste", "Sam");
table.Rows.Add(3, "Cream", "Christoff");
//Insert the DataTable to worksheet
worksheet.InsertDataTable(table, true, 1 , 1 , 2 , 2 , true);
//Save to file
workbook.SaveToFile(InsertDataTable.xlsx");
int InsertDataTable(DataTable dataTable, bool isFieldNameShown, int firstRow, int firstColumn, int maxRows, int maxColumns, bool preserveTypes)
Parameters
dataTable
DataTableDataTable with desired data.
isFieldNameShown
boolTrue if column names must also be imported.
firstRow
intRow of the first cell where DataTable should be imported.
firstColumn
intColumn of the first cell where DataTable should be imported.
maxRows
intMaximum number of rows to import.
maxColumns
intMaximum number of columns to import.
preserveTypes
boolIndicates whether XlsIO should try to preserve types in DataTable, i.e. if it is set to False (default) and in DataTable we have in string column value that contains only numbers, it would be converted to number.
Returns
- int
Number of imported rows.
InsertDataView(DataView, bool, int, int)
Imports data from a DataView into worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create a DataTable
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Item", typeof(string));
table.Columns.Add("Name", typeof(string));
table.Rows.Add(1, "Soap", "David");
table.Rows.Add(2, "Paste", "Sam");
table.Rows.Add(3, "Cream", "Christoff");
//Initialize dataview of datatable
System.Data.DataView view = table.DefaultView;
//Import data from DataView
worksheet.InsertDataView(view, true, 1, 1);
//Save to file
workbook.SaveToFile(InsertDataView.xlsx");
int InsertDataView(DataView dataView, bool isFieldNameShown, int firstRow, int firstColumn)
Parameters
dataView
DataViewDataView with desired data.
isFieldNameShown
boolTRUE if column names must also be imported.
firstRow
intRow of the first cell where DataView should be imported.
firstColumn
intColumn of the first cell where DataView should be imported.
Returns
- int
Number of imported rows.
InsertDataView(DataView, bool, int, int, bool)
Imports data from a DataView into worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create a DataTable
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Item", typeof(string));
table.Columns.Add("Name", typeof(string));
table.Rows.Add(1, "Soap", "David");
table.Rows.Add(2, "Paste", "Sam");
table.Rows.Add(3, "Cream", "Christoff");
//Initialize dataview of datatable
System.Data.DataView view = table.DefaultView;
//Import data from DataView
worksheet.InsertDataView(view, true, 1, 1 , true);
//Save to file
workbook.SaveToFile(InsertDataView.xlsx");
int InsertDataView(DataView dataView, bool isFieldNameShown, int firstRow, int firstColumn, bool bPreserveTypes)
Parameters
dataView
DataViewDataView with desired data.
isFieldNameShown
boolTRUE if column names must also be imported.
firstRow
intRow of the first cell where DataView should be imported.
firstColumn
intColumn of the first cell where DataView should be imported.
bPreserveTypes
boolIndicates whether to preserve column types.
Returns
- int
Number of imported rows.
InsertDataView(DataView, bool, int, int, int, int)
Imports data from a DataView into worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create a DataTable
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Item", typeof(string));
table.Columns.Add("Name", typeof(string));
table.Rows.Add(1, "Soap", "David");
table.Rows.Add(2, "Paste", "Sam");
table.Rows.Add(3, "Cream", "Christoff");
//Initialize dataview of datatable
System.Data.DataView view = table.DefaultView;
//Import data from DataView
worksheet.InsertDataView(view, true, 1, 1 , 2 , 2);
//Save to file
workbook.SaveToFile(InsertDataView.xlsx");
int InsertDataView(DataView dataView, bool isFieldNameShown, int firstRow, int firstColumn, int maxRows, int maxColumns)
Parameters
dataView
DataViewDataView with desired data.
isFieldNameShown
boolTRUE if column names must also be imported.
firstRow
intRow of the first cell where DataView should be imported.
firstColumn
intColumn of the first cell where DataView should be imported.
maxRows
intMaximum number of rows to import.
maxColumns
intMaximum number of columns to import.
Returns
- int
Number of imported rows.
InsertDataView(DataView, bool, int, int, int, int, bool)
Imports data from a DataView into worksheet.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create a DataTable
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Item", typeof(string));
table.Columns.Add("Name", typeof(string));
table.Rows.Add(1, "Soap", "David");
table.Rows.Add(2, "Paste", "Sam");
table.Rows.Add(3, "Cream", "Christoff");
//Initialize dataview of datatable
System.Data.DataView view = table.DefaultView;
//Import data from DataView
worksheet.InsertDataView(view, true, 1, 1 , 2 , 2 , true);
//Save to file
workbook.SaveToFile(InsertDataView.xlsx");
int InsertDataView(DataView dataView, bool isFieldNameShown, int firstRow, int firstColumn, int maxRows, int maxColumns, bool bPreserveTypes)
Parameters
dataView
DataViewDataView with desired data.
isFieldNameShown
boolTRUE if column names must also be imported.
firstRow
intRow of the first cell where DataView should be imported.
firstColumn
intColumn of the first cell where DataView should be imported.
maxRows
intMaximum number of rows to import.
maxColumns
intMaximum number of columns to import.
bPreserveTypes
boolIndicates whether to preserve column types.
Returns
- int
Number of imported rows
IsColumnVisible(int)
Method check is Column with specifed index visible to end user or not.
bool IsColumnVisible(int columnIndex)
Parameters
columnIndex
intIndex of column.
Returns
- bool
True - column is visible; otherwise False.
IsRowVisible(int)
Method check is Row with specifed index visible to user or not.
bool IsRowVisible(int rowIndex)
Parameters
rowIndex
intIndex of row visibility of each must be checked.
Returns
- bool
True - row is visible to user, otherwise False.
MoveWorksheet(int)
Moves worksheet.
void MoveWorksheet(int iNewIndex)
Parameters
iNewIndex
intNew index of the worksheet.
PixelsToColumnWidth(double)
Converts pixels into column width (in characters).
double PixelsToColumnWidth(double pixels)
Parameters
pixels
doubleWidth in pixels
Returns
- double
Widht in characters.
Protect(string)
Protects worksheet's content with password.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Protects the first worksheet's content with password
worksheet.Protect("123456");
//Save to file
workbook.SaveToFile("Protect.xlsx");
void Protect(string password)
Parameters
password
stringPassword to protect with.
Remove()
Removes worksheet from parent worksheets collection.
void Remove()
RemovePanes()
Removes panes from a worksheet.
void RemovePanes()
Replace(string, DataColumn, bool)
Replaces specified string by data column values.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Replace the oldValue by data column
string oldValue = "Find";
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("Dosage", typeof(int));
table.Rows.Add(1);
System.Data.DataColumn dataColumn = table.Columns[0];
worksheet.Replace(oldValue, dataColumn, true);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, DataColumn newValues, bool isFieldNamesShown)
Parameters
oldValue
stringString value to replace.
newValues
DataColumnData table with new data.
isFieldNamesShown
boolIndicates whether field name must be shown.
Replace(string, DataTable, bool)
Replaces specified string by data table values.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Replace the oldValue by data table
string oldValue = "Find";
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("Dosage", typeof(int));
table.Rows.Add(1);
worksheet.Replace(oldValue, table, true);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, DataTable newValues, bool isFieldNamesShown)
Parameters
oldValue
stringString value to replace.
newValues
DataTableData table with new data.
isFieldNamesShown
boolIndicates wheter field name must be shown.
Replace(string, DateTime)
Replaces specified string by specified value.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Replace the oldValue by dateTime
string oldValue = "Find";
DateTime dateTime = DateTime.Now;
worksheet.Replace(oldValue, dateTime);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, DateTime newValue)
Parameters
oldValue
stringString value to replace.
newValue
DateTimeNew value for the range with specified string.
Replace(string, double)
Replaces specified string by specified value.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Replace the oldValue by double
string oldValue = "Ten";
worksheet.Replace(oldValue, 10.0);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, double newValue)
Parameters
oldValue
stringString value to replace.
newValue
doubleNew value for the range with specified string.
Replace(string, double[], bool)
Replaces specified string by data from array.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Replace the oldValue by array of double values
string oldValue = "Find";
double[] newValues = { 1.0, 2.0 };
worksheet.Replace(oldValue, newValues, true);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, double[] newValues, bool isVertical)
Parameters
oldValue
stringString value to replace.
newValues
double[]Array of new values.
isVertical
boolIndicates whether array should be inserted vertically.
Replace(string, int[], bool)
Replaces specified string by data from array.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Replace the oldValue by array of int values
string oldValue = "Find";
int[] newValues = { 1, 2 };
worksheet.Replace(oldValue, newValues, true);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, int[] newValues, bool isVertical)
Parameters
oldValue
stringString value to replace.
newValues
int[]Array of new values.
isVertical
boolIndicates whether array should be inserted vertically.
Replace(string, string)
Replaces specified string by specified value.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Replace the oldValue by newValue
string oldValue = "Find";
string newValue = "NewValue";
worksheet.Replace(oldValue, newValue);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, string newValue)
Parameters
oldValue
stringString value to replace.
newValue
stringNew value for the range with specified string.
Replace(string, string[], bool)
Replaces specified string by data from array.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Replace the oldValue by array of string values
string oldValue = "Find";
string[] newValues = { "X values", "Y values" };
worksheet.Replace(oldValue, newValues , true);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, string[] newValues, bool isVertical)
Parameters
oldValue
stringString value to replace.
newValues
string[]Array of new values.
isVertical
boolIndicates whether array should be inserted vertically.
SaveToFile(string, string)
Save tabsheet using separator.
void SaveToFile(string fileName, string separator)
Parameters
Examples
The following code illustrates how to saves the worksheet in a different file with separator:
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Save to file
worksheet.SaveToFile("SaveToFile.csv" , ",");</code></pre>
SaveToHtml(Stream)
Save to HTML stream.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Creat stream
Stream stream = new MemoryStream();
//Save to HTML stream
worksheet.SaveToHtml(stream);
void SaveToHtml(Stream stream)
Parameters
stream
StreamStream object.
SaveToHtml(Stream, HTMLOptions)
Saves work sheet to HTML.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Creat stream
Stream stream = new MemoryStream();
//Save to HTML stream
worksheet.SaveToHtml(stream, Spire.Xls.Core.Spreadsheet.HTMLOptions.Default);
void SaveToHtml(Stream stream, HTMLOptions saveOptions)
Parameters
stream
StreamStream to save.
saveOptions
HTMLOptionsSave Options.
SaveToHtml(string)
Saves worksheet with specified filename.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Save to HTML file
worksheet.SaveToHtml("Output.html");
void SaveToHtml(string filename)
Parameters
filename
stringFile to save.
SaveToHtml(string, HTMLOptions)
Saves as HTML.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Save to HTML file
worksheet.SaveToHtml("Sample.html" , Spire.Xls.Core.Spreadsheet.HTMLOptions.Default);
void SaveToHtml(string filename, HTMLOptions saveOptions)
Parameters
filename
stringThe filename.
saveOptions
HTMLOptionsThe option.
SaveToStream(Stream, string)
Save tabsheet using separator.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create stream
Stream stream = new MemoryStream();
//Save to stream
worksheet.SaveToStream(stream , ",");
void SaveToStream(Stream stream, string separator)
Parameters
SetBlank(int, int)
Sets blank in specified cell.
void SetBlank(int iRow, int iColumn)
Parameters
iRow
intOne-based row index of the cell to set value.
iColumn
intOne-based column index of the cell to set value.
SetBoolean(int, int, bool)
Sets value in the specified cell.
void SetBoolean(int iRow, int iColumn, bool value)
Parameters
iRow
intOne-based row index of the cell to set value.
iColumn
intOne-based column index of the cell to set value.
value
boolValue to set.
SetColumnWidthInPixels(int, int)
Sets column width in pixels.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set column width
worksheet.SetColumnWidthInPixels(2, 160);
//Save to file
workbook.SaveToFile("SetColumnWidthInPixels.xlsx");
void SetColumnWidthInPixels(int columnIndex, int value)
Parameters
SetDefaultColumnStyle(int, IStyle)
Sets by column index default style for column.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create style
CellStyle style = workbook.Styles.Add("CustomStyle");
//Set Color
style.Color = Color.Red;
//Set default style
worksheet.SetDefaultColumnStyle(2, style);
//Save to file
workbook.SaveToFile("SetDefaultColumnStyle.xlsx");
void SetDefaultColumnStyle(int iColumnIndex, IStyle defaultStyle)
Parameters
SetDefaultColumnStyle(int, int, IStyle)
Sets by column index default style for column.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create style
CellStyle style = workbook.Styles.Add("CustomStyle");
//Set Color
style.Color = Color.Red;
//Set default style
worksheet.SetDefaultColumnStyle(2, 5, style);
//Save to file
workbook.SaveToFile("SetDefaultColumnStyle.xlsx");
void SetDefaultColumnStyle(int iStartColumnIndex, int iEndColumnIndex, IStyle defaultStyle)
Parameters
iStartColumnIndex
intStart column index.
iEndColumnIndex
intEnd column index.
defaultStyle
IStyleDefault style.
SetDefaultRowStyle(int, IStyle)
Sets by column index default style for row.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create style
CellStyle style = workbook.Styles.Add("CustomStyle");
//Set Color
style.Color = Color.Red;
//Set default style
worksheet.SetDefaultRowStyle(2, style);
//Save to file
workbook.SaveToFile("SetDefaultRowStyle.xlsx");
void SetDefaultRowStyle(int rowIndex, IStyle defaultStyle)
Parameters
SetDefaultRowStyle(int, int, IStyle)
Sets by column index default style for row.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Create style
CellStyle style = workbook.Styles.Add("CustomStyle");
//Set Color
style.Color = Color.Red;
//Set default style
worksheet.SetDefaultRowStyle(2, 5, style);
//Save to file
workbook.SaveToFile("SetDefaultRowStyle.xlsx");
void SetDefaultRowStyle(int iStartRowIndex, int iEndRowIndex, IStyle defaultStyle)
Parameters
iStartRowIndex
intStart row index.
iEndRowIndex
intEnd row index.
defaultStyle
IStyleDefault style.
SetError(int, int, string)
Sets error in the specified cell.
void SetError(int iRow, int iColumn, string value)
Parameters
iRow
intOne-based row index of the cell to set value.
iColumn
intOne-based column index of the cell to set value.
value
stringError to set.
SetFormula(int, int, string)
Sets formula in the specified cell.
void SetFormula(int iRow, int iColumn, string value)
Parameters
iRow
intOne-based row index of the cell to set value.
iColumn
intOne-based column index of the cell to set value.
value
stringFormula to set.
SetFormulaBoolValue(int, int, bool)
Sets formula bool value.
void SetFormulaBoolValue(int iRow, int iColumn, bool value)
Parameters
iRow
intOne based row index.
iColumn
intOne based column index.
value
boolRepresents formula bool value for set.
SetFormulaErrorValue(int, int, string)
Sets formula error value.
void SetFormulaErrorValue(int iRow, int iColumn, string value)
Parameters
iRow
intOne based row index.
iColumn
intOne based column index.
value
stringRepresents formula error value for set.
SetFormulaNumberValue(int, int, double)
Sets formula number value.
void SetFormulaNumberValue(int iRow, int iColumn, double value)
Parameters
iRow
intOne based row index.
iColumn
intOne based column index.
value
doubleRepresents formula number value for set.
SetFormulaStringValue(int, int, string)
Sets formula string value.
void SetFormulaStringValue(int iRow, int iColumn, string value)
Parameters
iRow
intOne based row index.
iColumn
intOne based column index.
value
stringRepresents formula string value for set.
SetNumber(int, int, double)
Sets value in the specified cell.
void SetNumber(int iRow, int iColumn, double value)
Parameters
iRow
intOne-based row index of the cell to set value.
iColumn
intOne-based column index of the cell to set value.
value
doubleValue to set.
SetRowHeightPixels(int, double)
Sets row height in pixels.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set row height
worksheet.SetRowHeightPixels(3, 150);
//Save to file
workbook.SaveToFile("SetRowHeightPixels.xlsx");
void SetRowHeightPixels(int Row, double value)
Parameters
SetText(int, int, string)
Sets text in the specified cell.
void SetText(int iRow, int iColumn, string value)
Parameters
iRow
intOne-based row index of the cell to set value.
iColumn
intOne-based column index of the cell to set value.
value
stringText to set.
SetValue(int, int, string)
Sets value in the specified cell.
void SetValue(int iRow, int iColumn, string value)
Parameters
iRow
intOne-based row index of the cell to set value.
iColumn
intOne-based column index of the cell to set value.
value
stringValue to set.
Unprotect(string)
Unprotects worksheet's content with password.
void Unprotect(string password)
Parameters
password
stringPassword to unprotect.
Events
CellValueChanged
Occurs when the value of a cell changes.
event XlsRange.CellValueChangedEventHandler CellValueChanged