Represents a single row within an Excel sheet, providing properties and methods to access and manipulate cells within the row. Facilitates row-specific operations such as creating new cells or retrieving existing ones, enhancing the ability to programmatically interact with sheet data at the row level.
public class Row
The Row class serves as a key component in the manipulation of sheet data, allowing for detailed, cell-level operations within individual rows. It provides a straightforward interface for accessing and modifying cells, crucial for tasks such as data entry, calculation, and formatting.
using Leadtools;
using Leadtools.Document.LEADOffice.Sheet;
public void CreateWorkbookFileExample()
{
// Initialize the workbook
var 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 value
cell.SetCellValue("LEADTOOLS");
// Style the cell
var 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 cell
cell.SetStyle(cellStyle);
// Save the workbook to disk
var filePath = Path.Combine(LEAD_VARS.ImagesDir, @"WorkbookTest.xlsx");
workbook.Save(filePath);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}