Enter Cell Data of GridWeb Worksheet in Percentage Format
Contents
[
Hide
]
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%.
If you have not set the cell style to Percentage Format, then input data 3% will display as 0.03.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |