Getting Started
The RadSpreadProcessing library enables you to create, import, and export spreadsheet documents programmatically.
If you still do not have Telerik Document Processing installed, check the First Steps topic to learn how you can obtain the packages through the different suites.
Package References
You can find the required references in the SpreadProcessing NuGet packages section.
Creating a Workbook
The document model allows you to instantiate a new workbook and populate it with any data you want.
The following example shows how to create a workbook and add a new worksheet to it.
Example 1: Create Workbook
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.Add();
You can then create a CellSelection and set any value to the selected cells. The following example shows how to create a cell and set a string value to it.
Example 2: Set Value of Cell
CellSelection selection = worksheet.Cells[1, 1]; //B2 cell
selection.SetValue("Hello RadSpreadProcessing");
Exporting
The RadSpreadProcessing library supports a variety of formats to which you can export the contents of a workbook using FormatProviders. The following example shows how to export the previously created workbook to .xlsx format.
For more examples and application scenarios of importing and exporting a Workbook to various formats, check the Import/Load and Export/Save RadSpreadProcessing Workbook knowledge base article.
Example 3: Export to Xlsx
string fileName = "SampleFile.xlsx";
XlsxFormatProvider formatProvider = new XlsxFormatProvider();
using (Stream output = new FileStream(fileName, FileMode.Create))
{
formatProvider.Export(workbook, output, TimeSpan.FromSeconds(10));
}
More information about the import and export features of RadSpreadProcessing is available in the Formats and Conversion section.
For more complete examples, go to the Developer Focused Examples section of the library.
Using RadSpreadsheet
RadSpreadsheet is a UI control part of the Telerik UI for WPF/Silverlight suites. The document model explained in this section of the documentation and all its features are shared between the RadSpreadProcessing library and RadSpreadsheet. This help section contains information about all UI-specific features of RadSpreadsheet.
See Also
- Using Telerik Document Processing First Steps
- What is a Workbook?
- What is a Worksheet?
- Get, Set and Clear Cell Properties
- Using XlsxFormatProvider
- Formats and Conversion section
- Import/Load and Export/Save RadSpreadProcessing Workbook KB
- Getting Started with RadSpreadProcessing Volume 1
- Getting started with RadSpreadProcessing Vol2
- Getting Started with RadSpreadProcessing Vol3
- SpreadProcessing Document Generation Demo