How to extract the formatter from a cell

Posted by: davide.vago on 18 December 2019, 10:57 am EST

    • Post Options:
    • Link

    Posted 18 December 2019, 10:57 am EST

    Good morning/afternoon.

    I’m currently trying to track user’s input data from an instance of the Workbook but I’m not able to fetch the cell format information.

    Reproduction test:

    • Create a spreadsheet instance, add few rows with pre-formatted data (e.g. percentages on row 1, 1 fixed floating number on row 2)

    • Bind the EditEnded event in order to get the cell information

    • As user add manually a new row and write on any cell a value like 10%

    I’m not able to get the % information from the EditEnded event as the value is 0.1 but there is no information within the CellRange formatter() method.

    Please do let me know if there is a sensible approach to achieve the format extraction.

    Thanks in advance for your support

  • Posted 19 December 2019, 1:05 am EST

    Hi Davide,

    You may use the getActualStyle() method to get information regarding the auto formatter. Please refer to the following code snippet:

    let style = sheet.getActualStyle(rowIndex, colIndex);
    let formatterString = style.formatter || (style._autoFormatter && style._autoFormatter.formatCached);
    

    Regards

    Sharad

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels