ExportRangeToXMLBuffer, ScriptExportRangeToXMLBuffer Methods
Applies To
fpSpread control
Description
Exports the specified range of cells in XML format and stores the information in a buffer.
Syntax
BOOL CSpreadSheet::ExportRangeToXMLBuffer(long Col, long Row, long Col2, long Row2, LPCTSTR Root, LPCTSTR Collection, BSTR* Buff, long Flags, LPCTSTR LogFile);
fpSpread1.ExportRangeToXMLBuffer(ByVal Col As Long, ByVal Row As Long, ByVal Col2 As Long, ByVal Row2 As Long, ByVal Root As String, ByVal Collection As String, Buff As String, ByVal Flags As ExportToXMLConstants, ByVal LogFile As String) As Boolean
Note: The ScriptExportRangeToXMLBuffer method uses the same syntax except method parameters that are not passed "ByVal" are declared as variants. For more information on Script methods, see Scripting Environment Usage. |
Parameters
The following parameters are available:
Parameter | Description | ||
---|---|---|---|
Col | Column number of first column in range to export | ||
Row | Row number of first row in range to export | ||
Col2 | Column number of last column in range to export | ||
Row2 | Row number of last row in range to export | ||
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. |
||
Buff | Returns the handle to the buffer | ||
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 range of data from a sheet to XML data in a buffer. The export creates XML data that provides the sheet data as a set of tagged XML elements. The XML data 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 Col, Row, Col2, and Row2 parameters to specify which cells to export. For example, you can use the BlockSelected event to determine which range of cells the user has selected, and then pass those parameters to the ExportRangeToXMLBuffer method to export the selected range.
Use the Root and Collection parameters to specify the root node necessary for valid XML data. 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.
Tip: You might want to save to a Spread (.SS8) file in addition to saving it as XML data in a buffer 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 |
Note: Call this method if you use the Spread control in a scripting environment (for example, Microsoft's Visual InterDev or Internet Explorer) or a non-scripting environment. However, if you want to use the Spread control in a scripting environment and you want to change any parameter that is not passed "ByVal", you must set the ScriptEnhanced property to True and call the ScriptExportRangeToXMLBuffer method. ScriptExportRangeToXMLBuffer method parameters that are not passed "ByVal" are declared as variants. |
For instructions and more information about saving data to a buffer, see Saving to a Buffer. For more information about XML export, see XML File Export (online PDF manual). XML File Export lists and describes the method in which Spread property settings are interpreted in the XML data.
Return Type
True if successful; otherwise, False.
See Also
Saving to a Buffer
XML File Export (online PDF manual)
Sheet property
ExportToXMLBuffer method
ScriptEnhanced property
DLL Correspondence
SSExportRangeToXMLBuffer function