Spread Windows Forms 6.0 Product Documentation
Using Serialization
Support Options
Spread Windows Forms 6.0 Product Documentation > Developer's Guide > Managing File Operations > Using Serialization

Glossary Item Box

In Spread, you can serialize objects in the spreadsheet or the entire spreadsheet component using several methods. Be sure you understand the difference between saving with the methods in FarPoint.Win.Serializer as opposed to the ones in the model namespace FarPoint.Win.Spread.Model.SpreadSerializer. The SpreadSerializer is intended for saving and loading entire Spread component objects or text files from a sheet, while the Serializer contains methods for saving and loading any serializable object using our XML serialization implementation. For more details on serializing and deserializing, refer to these tasks.

The method to use for simply saving an object to a file is SaveObject; the method for loading the object back from the file is LoadObject. The methods are overloaded so you can save or load to a stream or use a particular XML serialization interface. For many purposes the simple overload for SaveObject with only the object, filename, and root element name arguments, and the simple overload for LoadObject with only the type, filename, and element name should work. The SaveObject method checks to see if the object is in the FarPoint Spread DLL or the FarPoint Win DLL, and if not, then it saves the assembly name in the XML node attributes and uses that name to load the assembly in CreateObjectInstanceAndDeserialize.

Design-time serialization is very complicated, and Spread uses several custom CodeDomSerializer objects to serialize at design time. Those serializers are coded to expect the FpSpread and the SheetView to be fields in the object being serialized, and if the object is instead returned by a property accessor, the code probably is not get generated correctly. For this reason exposing a property of type FpSpread or SheetView at design time is not recommended.

Return to the overview of Managing File Operations.

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.