Other API Samples

Live SpreadsheetGear API Samples

Workbook Styles Modify Style

This sample will modify the "Normal" style, which is the default style used by all cells in a workbook. Modifying this style will typically modify all cells in the workbook, unless you have setup cells to use other styles.

// Create a new workbook.
SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook();
SpreadsheetGear.IWorksheet worksheet = workbook.Worksheets["Sheet1"];
SpreadsheetGear.IRange cells = worksheet.Cells;

// Get the "Normal" style for this workbook and modify it.
SpreadsheetGear.IStyle style = workbook.Styles["Normal"];
style.Font.Name = "Times New Roman";
style.Interior.Color = SpreadsheetGear.Colors.Yellow;

// Add some cell data to cell A1.
cells["B2"].Value = "Hello World!";
Run This Sample
Render Image

Generate an image representation of the results of this sample, which uses the SpreadsheetGear.Drawing.Image class to convert ranges, charts and shapes to images.

Download File

Download an Excel Open XML Workbook (*.xlsx) file with the results of this sample.

Related Samples
Workbook > Styles