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.

todo:image_alt_text

Sample Code

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Access cell A1 of first gridweb worksheet
GridCell cellA1 = GridWeb1.WorkSheets[0].Cells["A1"];
// Access cell style and set its number format to 10 which is a Percentage 0.00% format
GridTableItemStyle st = cellA1.Style;
st.NumberType = 10;
cellA1.Style = st;