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. Image for the cookie policy date

Grid Serialization

Hi! I have a problem with serialization of Essential Suite Grid v1.5. The Grid in my application has GridStyleInfo.CellType = "FormulaCell". So, when I try to serialize it, an exception is thrown, which says that Syncfuison.Windows.Forms.Grid.GridFormulaCellModel is not marked as serializable. I decided to apply GridStyleInfo.CellType = "TextBox" to the Grid, to serialize it and then to apply GridStyleInfo.CellType = "FormulaCell" again. I do it in the following way: private GridStyleInfo gridStyleInfo = new GridStyleInfo(); private GridBaseStyle gridBaseStyle = new GridBaseStyle(); Then in constructor after InitializeComponent() I write: this.gridBaseStyle.Name = "Standard"; this.gridStyleInfo.CellType = "FormulaCell"; this.gridBaseStyle.StyleInfo = this.gridStyleInfo; this.gridControl.BaseStylesMap.AddRange(new GridBaseStyle[] {this.gridBaseStyle}); And in the method, which serializes the Grid to a file, I write: private void Save() { this.gridStyleInfo.CellType = "TextBox"; this.gridBaseStyle.StyleInfo = this.gridStyleInfo; this.gridControl.BaseStylesMap.AddRange(new GridBaseStyle[] {this.gridBaseStyle}); this.gridControl.SaveSoap("Test.xml"); this.gridStyleInfo.CellType = "FormulaCell"; this.gridBaseStyle.StyleInfo = gridStyleInfo; this.gridControl.BaseStylesMap.AddRange(new GridBaseStyle[] {this.gridBaseStyle}); } Ok, I understand, that the styles set in the constructor and in the method Save() overlap each other, but all the same stay in memory. Can anybody help me? Thanks in advance.

1 Reply

Administrator June 15, 2004 01:07 PM UTC

You might want to update to or 2.0.x as these versions support serialization of the formula cells. I think the problem may be that just changing CellType from FormulaCell to TextBox does not do anything to the information that is stored in the style.FormulaTags. And the serialization of these objects is not supported in 1.5. So, if you wanted to do this, in addition to changing out celltypes, you would also have to make sure all teh FormulaTags were null.
Live Chat Icon For mobile
Up arrow icon