We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

General Cell Format

Is there a way to format a cell like Excel's "General" format so that numbers are automatically right aligned and strings are left aligned?

3 Replies

AD Administrator Syncfusion Team August 13, 2003 06:37 AM UTC

> Is there a way to format a cell like Excel's "General" format so that numbers are automatically right aligned and strings are left aligned? > No. But you could handle PrepareViewStyleInfo, and set e.Style.HorizontalAlignment dynamically. If you have explicitly set the CellValueType for your numeric cells, you could test e.Style.CellValueType to determine how to set the alignment. If you have not set the CellValueType, you could try parsing e.Style.Text to see if it parses as a number to test what is in the cell.


JE Jeff May 23, 2004 02:20 PM UTC

I need text to align right for financial numbers which seems to be a very common occurence for grids? Um can someone please create a sample for this for us not so advanced programmers? plz >> Is there a way to format a cell like Excel''s "General" format so that numbers are automatically right aligned and strings are left aligned? >> > >No. > >But you could handle PrepareViewStyleInfo, and set e.Style.HorizontalAlignment dynamically. If you have explicitly set the CellValueType for your numeric cells, you could test e.Style.CellValueType to determine how to set the alignment. If you have not set the CellValueType, you could try parsing e.Style.Text to see if it parses as a number to test what is in the cell.


AD Administrator Syncfusion Team May 23, 2004 04:22 PM UTC

Are you using one of our grids?

Loader.
Up arrow icon