Skip to main content

SpreadsheetRibbonItemCollectionBuilder.InsertFontNameItem(Int32) Method

Inserts the Font Name item to the ribbon item collection at the specified position.

Namespace: DevExpress.AspNetCore.Spreadsheet

Assembly: DevExpress.AspNetCore.Spreadsheet.v24.1.dll

NuGet Package: DevExpress.AspNetCore.Spreadsheet

Declaration

public RibbonSelectBoxItemBuilder InsertFontNameItem(
    int index
)

Parameters

Name Type Description
index Int32

The position to insert the item.

Returns

Type Description
RibbonSelectBoxItemBuilder

An object that can be used to further configure the inserted item.

Remarks

The example below demonstrates how to customize the font collection that the Font Name item displays:

@(Html.DevExpress()
    .Spreadsheet("spreadsheet")
    .Ribbon(ribbon =>
        ribbon.Tabs(tabs => {
            var homeTab = tabs.GetByName("Home");
            homeTab.Items(items => {
                // Removes the default Font Name item
                items.RemoveAt(6); 
                // Adds the Font Name item and customizes its font collection
                items.InsertFontNameItem(6).Items(fonts => {
                    fonts.Clear();
                    fonts.Add("Arial", "Arial");
                    fonts.Add("Calibri", "Calibri");
                    fonts.Add("Times New Roman", "Times New Roman");
                }); 
            });
        })
    )
    // ...
)
See Also