## Using the PercentCellType for Numbers with Units

Posted by: pontius on 8 September 2017, 2:59 pm EST

• Post Options:

Posted 8 September 2017, 2:59 pm EST

Hi,

I have to display numbers with engineering units like "50 mph" or "25 °C"  and would like to display them together in a cell.
The PercentCellType already has the PercentSign property that I could easily use for this purpose by setting the PercentSign = " mph" for instance.

Is there something to be said against this possibility?

Or should I better write my own EditBaseCellType derived CustomCellType class for this purpose?

Regards,
Pontius

• Post Options:

Replied 8 September 2017, 2:59 pm EST

Pontius,

Using the precent cell type as you are considering could cause some issues. The displayed value is 100 times the stored value (i.e. 25% is 0.25). When putting values into the spreadsheet, you would have to divide the values by 100. When getting values out of the spreadsheet, you would have to multiply the values by 100. Using formulas inside the spreadsheet could get tricky. For example, suppose cells A1:B1 represent the lengths of the sides of a rectangle which is "2 ft" by "3 ft" and you want to find the area of the rectangle in "sqft". The normal formula for finding area (i.e. =A1*B1) would produce the wrong result (i.e. "2 ft" * "3 ft" = 0.02 * 0.03 = 0.0006 = "0.06 sqft").

• Post Options:

Replied 8 September 2017, 2:59 pm EST

Hi bobbyo,

if that's all then I feel comfortable.

I do not use any formulas. I just allow the user to edit data (without editing the engineering unit). Later on I save the data in a file or read data from a file where I have to take into account the factor of 100.

Thanks and regards,
Pontius

##### Need extra support?

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

• #### ComponentOne

Forums for all current editions of the ComponentOne .NET UI control product line, including ComponentOne Studio and ComponentOne Studio for Xamarin.

• #### ActiveReports

Forums for all versions of ActiveReports Developer and Server

• #### Wijmo

Forums for all Wijmo products, including Wijmo Core, FinancialChart, FlexSheet, MultiRow, OLAP, and ReportViewer

• #### Document APIs

Forums for all versions of GrapeCity Documents for Excel and GrapeCity Documents for PDF

• #### Archives

Forums for GrapeCity legacy products, including Xuni and ActiveAnalysis.