Creates and adds a new sheet to the Excel workbook with the specified name. Allows for the dynamic expansion of the workbook by adding additional sheets.
sheetName
A string specifying the name of the new sheet. Sheet names must be unique within the workbook and should not contain illegal characters.
A new instance of the Sheet class, representing the newly created sheet within the workbook.
using Leadtools;using Leadtools.Document.LEADOffice.Sheet;public void CreateWorkbookFileExample(){// Initialize the workbookvar workbook = LEADWorkbookFactory.Create();// Add a new sheet named "Test"var sheet = workbook.CreateSheet("Test");// Access the first cell (assuming 0-based indexing)var cell = sheet.CreateRow(0).CreateCell(0);// Update the cell's valuecell.SetCellValue("LEADTOOLS");// Style the cellvar cellStyle = workbook.CreateCellStyle();cellStyle.Font = workbook.CreateFont("Arial", 12, FontStyle.Bold, RasterColor.FromKnownColor(RasterKnownColor.Black));cellStyle.BackgroundColor = RasterColor.FromKnownColor(RasterKnownColor.Gray);cellStyle.HorizontalAlignment = HorizontalAlignment.Center;cellStyle.VerticalAlignment = VerticalAlignment.Center;cellStyle.WrapText = TextWrap.Wrap;// Apply the style to the cellcell.SetStyle(cellStyle);// Save the workbook to diskvar filePath = Path.Combine(LEAD_VARS.ImagesDir, @"WorkbookTest.xlsx");workbook.Save(filePath);}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";}