Export TreeList Data
- 2 minutes to read
You can export the TreeList’s data to a data store in XML format, without any additional libraries. Call the TreeList.ExportToXml method. There are two overloads of this method available, which permit you to store data to a file and a stream. The data which has been stored using the ExportToXml method can then be loaded using the TreeList.ImportFromXml method. Note that data can be loaded using this method only in unbound mode (when the TreeList.DataSource property is not set).
If the XtraPrinting Library is available, the TreeList’s data can also be exported in CSV, DOCX, HTML, MHT, PDF, RTF, Text, XLS, and XLSX formats. To export data in these formats, use the corresponding ExportTo… method provided by the control. For instance, the TreeList.ExportToPdf method allows the Tree List data to be exported in PDF format.
It’s also possible to export the Tree List using a printable component link provided by the XtraPrinting Library. This approach is more flexible, as it allows you to customize the generated report (for instance, add report headers), and export the control in additional formats (such as BMP, GIF, PNG, etc). See the following links for more information: