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
Methods
Section titled “Methods”Method | Parameter/Return | Function |
---|---|---|
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
Section titled “Sheet Code Samples”To add, remove and get sheet from excel
// Adding new sheet to excelWorksheet worksheet = excel.AddSheet();Worksheet worksheet = excel.AddSheet("Data Sheet 2");// Get an existing sheet from ExcelWorksheet worksheet = excel.GetWorksheet("Data Sheet 3");// Remove existing sheet from ExcelWorksheet worksheet = excel.RemoveSheet("Sheet 1");// Rename existing sheetWorksheet worksheet = excel.RenameSheet("Data Sheet 2", "Sheet 1");
Sheet Column Settings Code Sample
Section titled “Sheet Column Settings Code Sample”Worksheet worksheet = excel.AddSheet();// Set Column propertyworksheet.SetColumn("A1", new ColumnProperties() { width = 30 });
ColumnProperties
Options
Section titled “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
Section titled “Sheet Row Data and Settings Code Sample”Worksheet worksheet = excel.AddSheet();// Set Row data and setting starting from A1 Cell and move rightworksheet.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.
Section titled “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 | CellStyleSetting? | 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 |
hyperlinkProperties | HyperlinkProperties | Set hyperlink property for the current cell |
RowProperties
Options
Section titled “RowProperties Options”Property | Type | Details |
---|---|---|
height | double? | Set row height property |
hidden | bool | Hide the row |