Spread.Services Documentation
Customize Worksheets
Spread.Services Documentation > Developer's Guide > Customize User Interaction > Manage Worksheet > Customize Worksheets

Spread.Services allows you to customize worksheets using the properties of IWorksheet Interface. You can perform useful operations like customizing gridlines to modify row and column headers, setting color for the tabs, or setting default height and width for rows and columns, and so much more.

Customizing a worksheet to modify the default settings involves the following tasks:

Configure display

You can modify the display settings of your worksheet from left to right or right to left.

Refer to the following example code to configure the display of your worksheet in Spread.Services.

C#
Copy Code
// Fetch the default WorkSheet
IWorksheet worksheet = workbook.Worksheets[0];

// Assign the values to the cells
worksheet.Range["B1"].Value = "ABCD";
worksheet.Range["B2"].Value = 3;
worksheet.Range["C1"].Value = "Services";
worksheet.Range["C2"].Value = 4;
worksheet.Range["D1"].Value = "Spread";
worksheet.Range["D2"].Value = "ABCD";

// Set the specified sheet to be displayed from left to right.
worksheet.SheetView.DisplayRightToLeft = true;

Set the tab color

You can change the default tab color of your worksheet using the TabColor property of the IWorksheet interface.

Refer to the following example code to set the tab color for your worksheet.

C#
Copy Code
// Set the tab color of the specified sheet as green.
worksheet.TabColor = Color.Green;

Set visibility

You can show or hide your worksheet using the Visible property of the IWorksheet interface.

Refer to the following example code to set visibility of your worksheet.

C#
Copy Code
// Adding new sheet and set the visibility of the sheet as Hidden.
IWorksheet worksheet1 = workbook.Worksheets.Add();
worksheet1.Visible = Visibility.Hidden;

Define standard width and height

You can define the standard height and width of your worksheet using the StandardHeight and StandardWidth properties of the IWorksheet interface, respectively.

Refer to the following example code to define the standard width and height as per your requirements.

C#
Copy Code
// Setting the height and width of the wokrsheet
worksheet.StandardHeight = 20;
worksheet.StandardWidth = 40;
See Also