.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
format a table cell
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
362 Views, 7 Replies
04-22-2010 01:22 PM
How do you format cells in a table to show numbers as 3-digit decimals?
I've tried this...
myTable.Cells(r, c).DataFormat = "#0.000" ' this does not work.
Is there more to it than this?
Allen
I've tried this...
myTable.Cells(r, c).DataFormat = "#0.000" ' this does not work.
Is there more to it than this?
Allen
Re: format a table cell
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-23-2010 01:19 AM in reply to:
Allen_Hart
Not tested
{code}
myTable.Cells(r, c).DataFormat = "%lu2%pr3%"
{code}
~'J'~
{code}
myTable.Cells(r, c).DataFormat = "%lu2%pr3%"
{code}
~'J'~
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
C6309D9E0751D165D0934D0621DFF27919
Re: format a table cell
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-26-2010 05:59 AM in reply to:
Allen_Hart
Thanks for the idea, but it does not work either.
There must be some special setup required prior to the assignment statement, but I can't find it.
Any other ideas?
Thanks,
Allen
There must be some special setup required prior to the assignment statement, but I can't find it.
Any other ideas?
Thanks,
Allen
Re: format a table cell
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-27-2010 12:24 PM in reply to:
Allen_Hart
This code is working for me
just need to set DataType before:
{code}
oTable.SetDataType(i, j, DataType.Double, UnitType.Distance);
oTable.SetDataFormat(i, j, "%lu2%pr3");
{code}
~'J'~
just need to set DataType before:
{code}
oTable.SetDataType(i, j, DataType.Double, UnitType.Distance);
oTable.SetDataFormat(i, j, "%lu2%pr3");
{code}
~'J'~
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
C6309D9E0751D165D0934D0621DFF27919
Re: format a table cell
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-28-2010 06:48 AM in reply to:
Allen_Hart
Here is what I have now, which works OK.
{code}
Dim oDTP As New DataTypeParameter
oDTP.DataType = DataType.Double
oDTP.UnitType = UnitType.Unitless
'oTable.SetDataType(r, c, DataType.Double, UnitType.Distance) 'obsolete
'oTable.SetDataFormat(r, c, "%lu2%pr3%") 'obsolete
oTable.Cells(r, c).DataType = oDTP
oTable.Cells(r, c).DataFormat = "%lu2%pr3%"
{code}
If I assign a value to the cell like this:
oTable.Cells(r, c).Value = 1.0
it will ignore the format and display the number in 6 decimals.
Is there a list somewhere of defined dataformat strings?
Thanks for all your help.
Allen
{code}
Dim oDTP As New DataTypeParameter
oDTP.DataType = DataType.Double
oDTP.UnitType = UnitType.Unitless
'oTable.SetDataType(r, c, DataType.Double, UnitType.Distance) 'obsolete
'oTable.SetDataFormat(r, c, "%lu2%pr3%") 'obsolete
oTable.Cells(r, c).DataType = oDTP
oTable.Cells(r, c).DataFormat = "%lu2%pr3%"
{code}
If I assign a value to the cell like this:
oTable.Cells(r, c).Value = 1.0
it will ignore the format and display the number in 6 decimals.
Is there a list somewhere of defined dataformat strings?
Thanks for all your help.
Allen
Re: format a table cell
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-28-2010 07:04 AM in reply to:
Allen_Hart
I'm still using A2008/Visual Studio2005
so it's not obsolete for me
Glad you have solved by yourself
~'J'~
so it's not obsolete for me
Glad you have solved by yourself
~'J'~
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
C6309D9E0751D165D0934D0621DFF27919
Re: format a table cell
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-03-2010 12:30 PM in reply to:
Allen_Hart
[SOLVED]
{quote}
If I assign a value to the cell like this:
oTable.Cells(r, c).Value = 1.0
it will ignore the format and display the number in 6 decimals.
{quote}
{code}oTable.Cells(r, c).DataFormat ="%lu2%pr2%th44" '<-- double with 2 decimals, %th44 = dot separated{code}
Works like a sharm
~'J'~
{quote}
If I assign a value to the cell like this:
oTable.Cells(r, c).Value = 1.0
it will ignore the format and display the number in 6 decimals.
{quote}
{code}oTable.Cells(r, c).DataFormat ="%lu2%pr2%th44" '<-- double with 2 decimals, %th44 = dot separated{code}
Works like a sharm
~'J'~
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
C6309D9E0751D165D0934D0621DFF27919
Re: format a table cell
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-22-2012 09:17 AM in reply to:
Allen_Hart
How to set data type to TEXT and format to Uppercase? Please help. Thanks!
