Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
875
Can you format negative values like Excel?
posted

In Excel, there is an option to format and display negative numbers in parentheses and red (with no negative sign showing) .  Is is possible to format negative numbers in the grid the same way?

I can change the color to red in the InitializeRow even by testing the values and changing the cell appearance.  If I change the number to a string, I can have the parentheses, but then I have to strip out the parens and convert when trying to get the value.

Parents
  • 3707
    posted

    View your UltraGrid Designer and navigate your ways to edit the properties of the columns. Select the column that you'll be formatting the negative numbers. Click into the Format property and paste this into there:

    $#,##0.00;($#,##0.00);Zero

    You can find the formatting references from Microsoft by clicking this link. For the conditional formatting you do not need to use InitializeRow, as we are already in the properties for this column, scroll down to the property called ValueBasedAppearance. With this dialog you can set conditions to change the appearance of the cell based on the value. Don't forget to delete what you had in InitializeRow to save overhead and any conflicting.

    Hope this helps you out!

Reply Children