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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Excel Behaviour for Large Numbers

Thread ID:

Created:

Updated:

Platform:

Replies:

48420 Aug 28,2006 04:27 AM UTC Sep 1,2006 12:24 PM UTC WinForms 5
loading
Tags: GridControl
Terence Rossow
Asked On August 28, 2006 04:27 AM UTC

Hi there,

We would like to have the same behaviour the Microsoft Excel has for large values. When the number gets too long a mask value is put in place rather than allowing the number to float (Excel uses ######). Is there anyway to do this in the Syncfusion Grids?

Cheers,
TERRY ROSSOW

Administrator [Syncfusion]
Replied On August 28, 2006 12:18 PM UTC

Hi Terry,

The DrawCellDisplayText event of the grid can be handled to achieve this. Try the below piece of code.

// DrawCellDisplayText event handler
if (e.RowIndex > 0 && e.ColIndex > 0)
{
SizeF siz = e.Graphics.MeasureString(e.Style.CellValue.ToString(), e.Style.GdipFont);
if ((siz.Width + 2) > e.ClipBounds.Width)
{
e.DisplayText = "##############";
}
}

Thanks for using Syncfusion Products.
Regards,
Rajagopal

Terence Rossow
Replied On August 31, 2006 01:26 AM UTC

Thanks for the reply. That''s basically what I had in mind.

There is a problem though. We use float/flood cell so that large amounts of text can spill over subsequent cells. Sometimes the flooding behaviour comes into effect before the DrawCellDisplayText event fires, and the ClipBounds is the bounds for both cells. Is there anyway to get the size for JUST the cell in question?

I have tried to turn on Floating and Flooding for only the cells that have numeric values in the PrepareViewStyleInfo, however for some reason Float and Flood doesn''t seem to work properly. I have tried both BeforeDisplayCalculation and OnDemandCalculation for FloatCellsMode of the grid, but no matter whether float or flood is on or off the floating behaviour doesn''t show up. Any ideas why this might be?

Cheers,
TERRY

Administrator [Syncfusion]
Replied On August 31, 2006 01:42 PM UTC

Hi Terry,

Please try the attached sample that seems to work as expected in bringing up the excel behavior for large numbers.

Here is a sample
http://www.syncfusion.com/Support/user/uploads/Forum_48420_4d615800.zip

Let me know if this helps.
Thanks,
Rajagopal

Terence Rossow
Replied On September 1, 2006 04:33 AM UTC

Thanks for the reply.

I think I didn''t explain properly. I wish to have the # mask for large numbers, but if the user enters text in a cell, have it spill over (using the float and flood cell properties).

If you could change the sample to show this I would be most greatful.

Thanks,
TERRY ROSSOW

Administrator [Syncfusion]
Replied On September 1, 2006 12:24 PM UTC

Hi Terry,

I have modifed the previous post attached sample as per your requirement. The modifed attached sample works fine with large number excel behavior and Let me know if you are looking something different.

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/ModifiedForum_48420_ee704a21.zip

Regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;