change particular column header text via method call

Hey Syncfusion team,

I'm using Syncfusion Angular Spreadsheet component and I need to change a particular column header text manually. Is there any method provided for this functionality?

Sample code requirement (something like following code):

this.spreadsheetObj.setHeaderText(<Header Info>, <Text to be transformed>);

Thanks and Regards,

Vivek SInghal


1 Reply

AS Aravinthan Seetharaman Syncfusion Team January 27, 2022 08:49 PM UTC

Hi Vivek, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked your requirement. We would let you know that currently we don’t have support for changing column header text. However, we have prepared sample for this requirement with some limitation like while “column insertion”  the applied custom text will be changed to original text. Please find the below code snippet and sample. 
 
  created: (): void => { 
    colCollection = spreadsheet.element.getElementsByClassName('e-header-cell'); 
    //Applies cell and number formatting to specified range of the active sheet 
    spreadsheet.cellFormat( 
      { fontWeight: 'bold', textAlign: 'center', verticalAlign: 'middle' }, 
      'A1:F1' 
    ); 
    spreadsheet.numberFormat('$#,##0.00', 'F2:F31'); 
  }, 
 
function setHeaderText(colIdx: number, text: string) { 
  colCollection[colIdx].innerText = text; 
} 
document.getElementById('btn').addEventListener('click', function () { 
  setHeaderText(0, 'Custom text'); 
}); 
 
 
 
Could you please check the above details and get back to us, if you need assistance on this. 
 
Regards, 
Aravinthan S 


Loader.
Up arrow icon