Serializing styleinfo only

Hi,

I am using GridControl. I am serializing the grid by using the code

TextWriter txtWriter = new StringWriter();
XmlSerializer xs = new XmlSerializer(this.Model.Data.GetType());

xs.Serialize(txtWriter, this.Model.Data);

This code serializes the format setting (style) of the cells along with the data contained in them.
How can I just serialize the style and not the data contained in the cells?
As an example, I have a few cells which have font set to times roman + bold, have a sum formula set in one cell. Now I want to have the settings restored instead of the actual data (i.e. the font settings and the applied formula in the same cells rather than the data on which the font changes and formula were applied.)

thanks
vivek

1 Reply

AD Administrator Syncfusion Team June 22, 2007 04:41 PM UTC

The CellValue is part of the GridStyleInfo object so it will get serialized by default. One way to avoid this is to subscribe to the GridStyleInfoStore.CellValueProperty.WriteXml event, and selectively ignore writing out the cell value at that point. Here is a sample that does this.


35063.zip

Loader.
Up arrow icon