Available for: UI for ASP.NET AJAX | UI for ASP.NET MVC | UI for WPF | UI for WinForms | UI for Silverlight

General Information

RadSpreadProcessing's document model allows you to easily open and save files of different formats. Currently, the supported formats include:

  • Xlsx: Rich text format, which exports the whole content of a workbook: worksheets, formula values, formatting, hyperlinks etc.

  • Pdf: Fixed format, which preserves the content of a workbook in independent from software or hardware manner.

  • Csv(comma separated): Plain text format that saves the content of the cell in the active worksheet. The format strips all formatting and keeps only the result values of cells. These values are separated by a culture dependent delimiter.

  • Txt(tab delimited): Plain text format, which preserves only the content of the cells in the active worksheet. The format does not save any formatting and keeps only the result values of the cells. These values are delimited via tabs.

The document model exposes four format providers that work with each of the formats above: XlsxFormatProvider, CsvFormatProvider, PdfFormatProvider and TxtFormatProvider. All of them implement the IWorkbookFormatProvider interface and, thus, share a common API that enables import and export of files. To conform to the interface each of the providers implements two methods that, respectively, turn a stream into a workbook and save the contents of the workbook into a stream:

  • Workbook Import(Stream input)

  • void Export(Workbook workbook, Stream output)

Unlike the CsvFormatProvider and TxtFormatProvider classes, the XlsxFormatProvider requires references to the following assemblies:

  • Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.dll

  • Telerik.Windows.Zip.dll

PdfFormatProvider requires reference to the following assembly:

  • Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf.dll

The document model of RadSpreadProcessing also contains a WorkbookFormatProvidersManager class, which exposes a whole set of useful static methods. The manager allows you to specify a set of format providers you would like to use. Then you can import and export a file leaving the manager to choose the appropriate format provider to use. You only need to specify the extension of the file that you open or save:

  • public static Workbook Import(string extension, Stream input)

  • public static void Export(Workbook workbook, string extension, Stream output)

The Formats and Conversion section contains four separate folders dedicated on each of the format providers and one article that illustrates how to work with the WorkbookFormatProvidersManager class.

See Also

In this article
Not finding the help you need? Improve this article