Posted 5 December 2022, 9:21 am EST
Example:
Formatted value: (120,000.00);
Formatter: ($* #,##0.00;($* (#,##0.00);
Expected raw value output: -120000;
Forums Home / Spread / SpreadJS
Posted by: pavloboiko on 5 December 2022, 9:21 am EST
Posted 5 December 2022, 9:21 am EST
Example:
Formatted value: (120,000.00);
Formatter: ($* #,##0.00;($* (#,##0.00);
Expected raw value output: -120000;
Posted 7 December 2022, 12:09 am EST
Hi,
You can convert the formatted value to raw value using editCell command. You can do so by setting autoFormat property to true in options of editCell command. This command assigns value to a cell as well as formats that value. You can also get raw data by creating an instance of GC.Spread.Formatter.GeneralFormatter class and using method generalFormatter.parse(string).
Please refer to the attached sample.
Sample: https://codesandbox.io/s/solution-forked-mg1znf?file=/src/index.js
Doc reference:
editCell command: https://www.grapecity.com/spreadjs/api/modules/GC.Spread.Sheets.Commands#editcell
GeneralFormatter class: https://www.grapecity.com/spreadjs/api/classes/GC.Spread.Formatter.GeneralFormatter
generalFormatter.parse(): https://www.grapecity.com/spreadjs/api/classes/GC.Spread.Formatter.GeneralFormatter#parse
Regards,
Ankit