Worksheet

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

Methods

MethodParameter/ReturnFunction

GetSheetId

/string

Return current sheet id

GetSheetName

/string

Return current sheet name

SetColumn

cilumn,ColumnProperty

Set column property

SetRow

cellid,cellData,RowProperty

Set row property and data

AddPicture

filePath,PictureSetting/Picture

Add Picture to current slide

AddChart

DataRange,chartSetting/Chart

Add Chart to current slide

GetMergeCellList

/List<MergeCellRange>

Get existing merge range from current sheet

SetMergeCell

MergeCellRange/bool

Set new merge range if not affecting existing

RemoveMergeCell

MergeCellRange/bool

Remove any existing range within the caller range

Sheet Code Samples

To add, remove and get sheet from excel

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

Sheet Column Settings Code Sample

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

ColumnProperties Options

PropertyTypeDetails

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 = excel.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.

PropertyTypeDetails

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

PropertyTypeDetails

height

double?

Set row height property

hidden

bool

Hide the row

Last updated