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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

FormulaTag not cleared when formula overtyped by a value

Thread ID:





26475 Mar 23,2005 04:08 PM UTC Mar 24,2005 04:07 PM UTC WinForms 3
Tags: GridControl
Tom Abraham
Asked On March 23, 2005 04:08 PM UTC

I have a GridControl with lots of FormulaCells populated with formulas. The user often comes through and overtypes formulas with plain numeric values. It appears that when this happens, the FormulaTag is not cleared and the cell either displays the wrong value or it does not follow the specified number format (.Format).

Administrator [Syncfusion]
Replied On March 23, 2005 04:44 PM UTC

I can understand the format being lost when you type over a formula in a formulacell with a number. Here is why. Normally, in order for style.Format to be applied to a cell value, the style.CellValueType needs to be set properly to something like a typeof(double) or whatever. Formula cells need to be string CellValueType since they have to be able to hold and save strings. This would nromallymean that style.Format would be ignored. But in GridFormulaCellModel.GetFormattedText, there is special code to aplly the style.Format if the cell actually holds a formula. But if the cell does not hold a formula, a baseclass call is made to get the formatted text and this is causing the problem of losing the format when you type a number. I will enter a request to add code to GridFormulaCellModel.GetFormattedText to format any FormulaCell if style.Format is set and the cell holds something for which the format makes sense. This should avoid the typed numbers losing their format. But I do not understand about the wrong calculations. Are you using the GridControl in virtual mode? If so, then you should clear any cached FormulaTags in SaveCellInfo when e.Style.Text does not start with an "=" sign. Are there any exceptions being thrown when you see the wrong calculations? Can you tell us how to reproduce this in one of our samples, or can you upload a sample showingthe problem?

Tom Abraham
Replied On March 24, 2005 03:44 PM UTC

I''ve had to build custom formatting logic in DrawCellDisplayText to work around these formatting issues. Part of that took the calculated value from the FormulaTag if it existed, and since the grid didn''t clear it, it didn''t display what the user typed. I''m now having to clear the FormulaTag myself in SaveCellInfo. Seems like everywhere I turn there are issues with fairly obvious uses of FormulaCell-based grids. I hope SyncFusion will focus more testing effort on FormulaCells for future releases. I do appreciate the quick response to questions. Thanks, Tom

Administrator [Syncfusion]
Replied On March 24, 2005 04:07 PM UTC

Thank you for reproting the probelm you are seeing. I will make a note of this to see check on changing this in our library. The engine code tries to test style.Text to see whether it holds a formula or not before trying to make use of style.FormulaTag. This is why this situation has not come up before.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon