Enter Cell Data of GridWeb Worksheet in Percentage Format
Possible Usage Scenarios
GridWeb now supports users to enter cell data in percentage format like 3% and the data in the cell will automatically be formatted as 3.00%. However, you will have to set the cell style to Percentage Format which is either GridTableItemStyle.NumberType a 9 or 10. The number 9 will format 3% as 3% but the number 10 will format 3% as 3.00%.
Enter Cell Data of GridWeb Worksheet in Percentage Format
The following sample code sets the cell A1 GridTableItemStyle.NumberType as 10, therefore the input data 3% automatically be formatted as 3.00% as shown in the screenshot.
Sample Code
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
//Access cell A1 of first gridweb worksheet | |
GridCell cellA1 = gridweb.getWorkSheets().get(0).getCells().get("A1"); | |
//Access cell style and set its number format to 10 which is a Percentage 0.00% format | |
GridTableItemStyle st = cellA1.getStyle(); | |
st.setNumberType(10); | |
cellA1.setStyle(st); | |