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

Clearing cell value and formula tag but not formatting

Thread ID:





40936 Feb 16,2006 08:29 PM UTC Feb 17,2006 04:50 PM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On February 16, 2006 08:29 PM UTC

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 04:50 PM UTC

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


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