ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2015-01-29 11:53:12

boldtm
Member
Registered: 2015-01-18
Posts: 7

Clearing cells' range values

Hi!

Is there a simple way to clear only values in range, leaving formats and formulas intact?
If not, treat it like improvement suggestion smile

-boldtm

Offline

#2 2015-01-29 12:00:40

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Clearing cells' range values

Hi boldtm, try ClearRangeContent and pass the second argument as Data. This method provides the functionality to clear content from specified range, content could be specified (data, formula, data format, style, border and etc...).

sheet.ClearRangeContent("A1:B5", CellElementFlag.Data);

Or use DeleteRangeData method.

sheet.DeleteRangeData(new ReoGridRange("A1:B5"));

If you want this deleting operation could be undone, use this:

grid.DoAction(new RemoveRangeDataAction(new ReoGridRange("A1:B5")));

Edit: sorry, I've checked the ClearRangeContent with argument CellElementFlag.Data, it deletes formula. I think it is impossible to delete data but formula, even if it is possible, the cell will be updated instantly and the data of formula's value will be displayed again if any referenced cell was updated. What's case of you want do this?

Jing

Last edited by Jingwood (2015-01-29 12:14:31)

Offline

#3 2015-01-29 16:06:07

boldtm
Member
Registered: 2015-01-18
Posts: 7

Re: Clearing cells' range values

It's OK for me to leave computed values in cells with formulas. I didn't mean getting grid blank.
I'd like to use grid as a form: fill some cells, automatically get in other cells computed values and print it all.

I thought about something like this in OpenOffice https://wiki.openoffice.org/wiki/Docume … l_Contents. Based on specified flag only selected properties are cleared.

I suppose ClearRangeContent is exactly what I'm looking for.

Thanks, for fast and thorough answer.

Last edited by boldtm (2015-01-29 16:18:58)

Offline

Board footer

Powered by FluxBB