Text in column Header

Currently I'm changing the columns headers as suggested on docs :

https://ej2.syncfusion.com/angular/documentation/spreadsheet/rows-and-columns#changing-text-in-column-headers

But that customization is also applying for new added sheets (programatically and UI ).

Is there any way to only apply the header customization to certain sheets ? Based on sheet name or index would be perfet


Kindly waiting.


1 Reply 1 reply marked as answer

JS Janakiraman Sakthivel Syncfusion Team August 7, 2024 12:47 PM UTC

Hi Ernesto Mejia,

We have reviewed your query and suggest checking the current active sheet name against the collection of modification required sheet names before changing the column header text. Please find the modified code snippets below.


For your convenience, we have prepared a sample and shared on below.

Sample: 
Uaugjz (forked) - StackBlitz


CODE SNIPPET:


beforeCellRender(args: CellRenderEventArgs) {

        if (this.spreadsheetObj.getActiveSheet().name === 'Sheet1') {

            // Condition to check whether the rendered element is header cell.

            if (args.colIndex >= 0 && args.colIndex <= 10 && args.element.classList.contains('e-header-cell')) {

                let text = 'custom header ' + args.colIndex.toString();

                // Add the custom text to the innerText of the element.

                args.element.innerText = text;

            }

        }

}

 


API reference:
 
Angular Spreadsheet API component - Syncfusion

Kindly check the details shared above on your end and get back to us if you need further clarification regarding this. We hope this helps.


Marked as answer
Loader.
Up arrow icon