Skip to content

Worksheet

Note: New features related to this feature is been worked on release v2.8.x. Document is not upto date

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

MethodParameter/ReturnFunction
GetSheetId/stringReturn current sheet id
GetSheetName/stringReturn current sheet name
SetColumncilumn,ColumnPropertySet column property
SetRowcellid,cellData,RowPropertySet row property and data
AddPicturefilePath,PictureSetting/PictureAdd Picture to current slide
AddChartDataRange,chartSetting/ChartAdd Chart to current slide
GetMergeCellList/List<MergeCellRange>Get existing merge range from current sheet
SetMergeCellMergeCellRange/boolSet new merge range if not affecting existing
RemoveMergeCellMergeCellRange/boolRemove any existing range within the caller range

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");
Worksheet worksheet = excel.AddSheet();
// Set Column property
worksheet.SetColumn("A1", new ColumnProperties()
{
width = 30
});
PropertyTypeDetails
bestFitboolAuto bit column width based on content.
hiddenboolHide the column
widthdouble?Set manual column width.
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
});
PropertyTypeDetails
cellValuestring?Can be any value or null. Will be parsed based on dataType
dataTypeCellDataTypeRefer to the data type present in cellValue property
styleSettingCellStyleSetting?AVOID USING THIS. Used to set specific cell style. For optimised performance refer Style Component
styleIduint?Insert the style Id returened from Style Componenet
hyperlinkPropertiesHyperlinkPropertiesSet hyperlink property for the current cell
PropertyTypeDetails
heightdouble?Set row height property
hiddenboolHide the row