class CGXxxxFTR : public CXMLSerializeImp

These set of CGXxxxFTRs are used to plug-in grid’s data structures into the XML Serialization architecture to enable serializing them as XML data.

The Grid XML Serialization architecture consists of the Core framework and the Grid adapter classes. The Core framework used by all of our products is available in our SFL library and the Grid adapter classes consists of these set of CGXxxxFTR classes. Please refer to the SFL Users Guide and class information for more information on the Core framework classes and the Grid User’s guide for more information on the Grid XML Serialization adapter classes.

Here is the list of Grid adapter classes, which we call Formatters in general, and their corresponding Grid classes.

CGXDataFTR CGXData

CGXPrintDeviceFTR CGXPrintDevice

CGXPropertiesFTR CGXProperties

CGXRangeFTR CGXRange

CGXStyleFTR CGXStyle

CGXStylesMapFTR CGXStylesMap

CGXGridParamFTR CGXGridParam

CGXBrushFTR CGXBrush

CGXFontFTR CGXFont

CGXCollMapDWordToLongFTR CGXCollMapDWordToLong

CGXUserPropertyInfoFTR CGXProperties::UserPropertyInfo

CGXAbstractUserAttributeFTR CGXAbstractUserAttribute

CGXUserAttributeFTR CGXUserAttribute

CGXEllipseUserAttributeFTR CGXEllipseUserAttribute

CGXOleVarUserAttributeFTR CGXOleVarUserAttribute

CGXDelayedRangeFTR CGXDelayedRange

We need Formatters to plug into the XML serialization framework because the framework can only Serialize classes with the IXMLSerialize interface, besides the fundamental types (Just like the MFC serialization can handle only Cobject derived classes). The Formatters derive from IXMLSerialize interface and serializes data from the corresponding attached object in their XMLSerialization override.

The constructors for the Formatters take a reference to their corresponding objects (so that data can be serialized in and out) and an optional string indicating the tagName of the corresponding element in the XML document.

To serialize all the grid data you just have to serialize the CGXGridParam object, which would in turn serialize the rest of its aggregated, above grid data structures.

The example below shows how to serialize the CGXGridParam in your application. You could alternatively serialize only a portion of the grid by serializing only a portion of the grid’s data structures.

#include <grid/xmlser/gxxmlser.h>

Example

Taken from our Grid\General\Gridapp sample, this example shows how to add serialization support in your document:

// Your document class should derive from SECXMLDocAdapter_T
// Override the following virtuals in IXMLSerialize
void CGridSampleDoc::GetElementType(LPTSTR str)
{
   // The tag name under which your document data will be stored.
   _tcscpy(str, _T("MyGridDocument"));
}
void CGridSampleDoc::XMLSerialize(SECXMLArchive& ar)
{
   if(ar.IsStoring())
   {
      CGXGridParam* pParam = // Obtain a reference to the parameter object.
      // Writing the Grid param
      ar.Write(NULL, CGXGridParamFTR(pParam));
   }
   else
   {
      // Create a param object into which to serialize.
      // You could alternatively pass in a NULL reference and let the formatter create a corresponding object for you.
      CGXGridParam* pParam = new CGXGridParam();
      if(!ar.Read(NULL, CGXGridParamFTR(pParam)))
         AfxMessageBox(_T("Unable to recognize XML file format."));
   }
}