Worksheet

Adding, Modifying a sheet from spreadsheet is handled by this class object

Sheet Code Samples

To add, remove and get sheet from excel

// Adding new sheet to spreadsheet
Worksheet worksheet = spreadsheet.AddSheet();
Worksheet worksheet = spreadsheet.AddSheet("Data Sheet 2");
// Get an existing sheet from Excel
Worksheet worksheet = spreadsheet.GetWorksheet("Data Sheet 3");
// Remove existing sheet from Excel
Worksheet worksheet = spreadsheet.RemoveSheet("Sheet 1");
// Rename existing sheet
Worksheet worksheet = spreadsheet.RenameSheet("Data Sheet 2", "Sheet 1");

Sheet Column Settings Code Sample

Worksheet worksheet = spreadsheet.AddSheet();
// Set Column property
worksheet.SetColumn("A1", new ColumnProperties()
	{
		width = 30
	});

ColumnProperties Options

Property
Type
Details

bestFit

bool

Auto bit column width based on content.

hidden

bool

Hide the column

width

double?

Set manual column width.

Sheet Row Data and Settings Code Sample

Worksheet worksheet = spreadsheet.AddSheet();
// Set Row data and setting starting from A1 Cell and move right
worksheet.SetRow("A1", 
	new DataCell[6]{
		new DataCell(){
			cellValue = "test1",
			dataType = CellDataType.STRING
		},
		 new DataCell(){
			cellValue = "test2",
			dataType = CellDataType.STRING
		},
		 new DataCell(){
			cellValue = "test3",
			dataType = CellDataType.STRING
		},
		 new DataCell(){
			cellValue = "test4",
			dataType = CellDataType.STRING,
			styleSetting = new(){
				fontSize = 20
			}
		},
		 new DataCell(){
			cellValue = "2.51",
			dataType = CellDataType.NUMBER,
			styleSetting = new(){
				numberFormat = "00.000",
			}
		},new(){
			cellValue = "5.51",
			dataType = CellDataType.NUMBER,
			styleSetting = new(){
				numberFormat = "₹ #,##0.00;₹ -#,##0.00",
			}
		}
	}, new RowProperties()
	{
		height = 20
	});

DataCell Options.

Property
Type
Details

cellValue

string?

Can be any value or null. Will be parsed based on dataType

dataType

CellDataType

Refer to the data type present in cellValue property

styleSetting

AVOID USING THIS. Used to set specific cell style. For optimised performance refer Style Component

styleId

uint?

Insert the style Id returened from Style Componenet

RowProperties Options

Property
Type
Details

height

double?

Set row height property

hidden

bool

Hide the row

Last updated