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

Clearing cell value and formula tag but not formatting

Thread ID:

Created:

Updated:

Platform:

Replies:

40936 Feb 16,2006 03:29 PM Feb 17,2006 11:50 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 16, 2006 03:29 PM

Hi, I''ve noticed that when I do a gridmodel.Clear(clearStyle = false), all the cellvalues are reset but any formula tags remain. I know if I set clearStyle = True, then everything would be cleared, but in my case I need to preserve all formatting. How can I clear the value and formula tag of a range of cells? Thanks.

stanleyj [Syncfusion]
Replied On February 17, 2006 11:50 AM

Hi Alex, To remove the value in the Tag, the selected range has to be looped through. Here is the code to Clear the cell value and the tag. public void Clear() { GridRangeInfo selectedRange = this.gridControl1.Selections.Ranges.ActiveRange; // Clear Only the value && tag for (int rowIndex = selectedRange.Top; rowIndex <= selectedRange.Bottom; rowIndex++) { for (int colIndex = selectedRange.Left; colIndex <= selectedRange.Right; colIndex++) { GridStyleInfo style = this.gridControl1.Model[rowIndex, colIndex]; this.gridControl1.Model[rowIndex, colIndex].Tag = null; if (style.GetFormattedText(style.CellValue).Length > 0) style.ApplyFormattedText(""); } } } Best regards, Stanley

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.

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.

;