ReoGrid icon indicating copy to clipboard operation
ReoGrid copied to clipboard

DropdownListCell body type is not serializing/deserializing in any format when saving/loading workbook

Open SumedhaRao opened this issue 4 years ago • 1 comments

image

SumedhaRao avatar Mar 09 '21 05:03 SumedhaRao

Now the interface for saving and loading custom cell body has been added.

The custom cell body data provider can be added or remoted by access the RGFPersistenceProvider.CustomBodyTypeProviders list.

// My custom cell body
class MyCellBody : CellBody
{
}

// The provider used to save and load cell body
class MyCellBodyPersistenceProvider : RGFCustomBodyHandler
{
	public object LoadData(Cell cell, string data)
	{
		return "Loaded";
	}

	public string SaveData(Cell cell)
	{
		return "Saved";
	}
}

Add custom persistence provider:

RGFPersistenceProvider.CustomBodyTypeProviders.Add(typeof(MyCellBody), "my-cell-body", new MyCellBodyPersistenceProvider());

Test

sheet["A1"] = new MyCellBody();

And save the worksheet as RGF, the data value will be stored as:

<cell row="0" col="0" body-type="my-cell-body">Saved</cell>

jingwood avatar Apr 03 '21 15:04 jingwood