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

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.

RowProperties Options

Last updated