ExportToXML Method
Applies To
fpSpread control
Description
Exports the sheet to an XML file.
Syntax
BOOL CSpreadSheet::ExportToXML(LPCTSTR FileName, LPCTSTR Root, LPCTSTR Collection, long Flags, LPCTSTR LogFile);
fpSpread1.ExportToXML(ByVal FileName As String, ByVal Root As String, ByVal Collection As String, ByVal Flags As ExportToXMLConstants, ByVal LogFile As String) As Boolean
Parameters
The following parameters are available:
Parameter | Description | ||
---|---|---|---|
FileName | Path and file name of the XML file to create | ||
Root | Root element to use in the XML file Do not use spaces in this string. |
||
Collection | Collection element to use in the XML file Do not use spaces in this string. |
||
Flags | Whether to export formatted or unformatted data Use one of the following values: |
||
Constant | Value | Description | |
ExportToXMLFormattedData | 0 | To export data as formatted data | |
ExportToXMLUnFormattedData | 1 | To export data as unformatted data | |
LogFile | Path and file name of log file to create If you do not provide a file name, the export will not create a log file. If you do not want to create a log file, set this parameter to "". |
Remarks
Use this method to export a sheet to an XML file. The export creates an XML file that provides the sheet data as a set of tagged XML elements. The XML file created conforms to XML 1.0 guidelines.
This method is called for the current sheet setting unless you first set the Sheet property to specify the sheet with which you want to work.
Use the Root and Collection parameters to specify the root node necessary for a valid XML file. The export uses the column headers in the sheet as the child elements within each collection element. If you provide custom text for the column headers, do not use spaces in the text; XML tags cannot contain spaces. If the sheet does not contain text in the column headers, the child element tags in the XML file default to <A>, <B>, <C>, and so forth. The export ignores any row headers.
Use the Flags parameter to specify whether formatted or unformatted data is saved to the XML file. For more information about formatted and unformatted data, see Formatted and Unformatted Data.
If you want to export a range of cells instead of the entire sheet, use the ExportRangeToXML method instead.
By default, XML files created using the fpSpread control or the Spread Designer have the extension .XML. However, you may use any extension.
Tip: You might want to save to a Spread (.SS8) file in addition to saving it as XML so that you can open the Spread (.SS8) file for future modifications. |
The following table summarizes the formats to which you can save data from a workbook or sheet:
To Save To . . . | Use Method |
---|---|
Binary file (proprietary format) | SaveToFile |
Tab-delimited file | SaveTabFile or SaveTabFileU |
Delimited file (offers user-defined delimiters) | ExportToTextFile or ExportRangeToTextFile or ExportToTextFileU or ExportRangeToTextFileU |
Excel-formatted file | ExportExcelBook or ExportToExcel |
HTML file | ExportToHTML or ExportRangeToHTML |
XML file | ExportToXML or ExportRangeToXML |
XML buffer | ExportToXMLBuffer or ExportRangeToXMLBuffer |
An array | GetArray |
For instructions and more information about exporting XML files, see Exporting to an XML File and XML File Export (online PDF manual). XML File Export lists and describes the method in which Spread property settings are interpreted in the XML file created.
Return Type
True if successful; otherwise, False.
See Also
Exporting to an XML File
XML File Export (online PDF manual)
Sheet property
ExportRangeToXML, ExportRangeToXMLBuffer, ExportToXMLBuffer methods
DLL Correspondence
SSExportToXML function