This article will get you started in using the RadSpreadsheet control. It contains the following sections:
In order to use the RadSpreadsheet control in your project you need to add references to the following assemblies:
You can access the needed assemblies from the
AdditionalLibraries folder in the Telerik® UI for ASP.NET AJAX installation (automated and manual) and from the internal builds archive. They support .NET 4 and .NET 4.5, so depending on the target framework of your project, you need to take the assemblies from the
Bin40 or the
Bin45 folder respectively.
The following assemblies are required in order to be able to use the control with the predefined SpreadsheetDocumentProvider (applicable for most scenarios):
Telerik.Windows.Documents.Core.dll — the main assembly from the Telerik document processing libraries.
Telerik.Windows.Zip.dll — needed for working with zipped formats (DOCX, XLSX) and PDF.
Telerik.Windows.Documents.Spreadsheet.dll — the main assembly for the spreadsheet processing. It is needed for processing XLSX, CSV, TXT documents.
Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.dll — needed for processing XLSX documents.
You could find the above assemblies in the AdditionalLibraries folder of the installation directory on your machine (C:\Program Files\Progress\UI for ASP.NET AJAX RX YYYY).
To create a new instance of RadSpreadsheet on your page using the designer, you should follow the below steps:
Drag a RadSpreadsheet control from the Toolbox onto your Web Page.
The Smart Tag should appear automatically. Within the Smart Tag menu, from the Skin drop-down chose the desired Skin for this control:
- Run the application. You should see the newly created empty RadSpreadsheet on your page:
Binding the RadSpreadsheet to a provider at runtime requires two simple steps:
Create an excel file and copy it to the App_Data folder of your project. In this example we have created a file with a name "Spreadsheet.xlsx".
Set the Provider property in the code behind, by assigning it an instance of the Telerik.Web.UI.SpreadsheetDocumentProvider class, with the path to the excel file as a parameter:
protected void Page_Init(object sender, EventArgs e)
RadSpreadSheet1.Provider = new SpreadsheetDocumentProvider(Server.MapPath("~/App_Data/Spreadsheet.xlsx"));
Protected Sub Page_Init(sender As Object, e As EventArgs)
RadSpreadSheet1.Provider = New SpreadsheetDocumentProvider(Server.MapPath("~/App_Data/Spreadsheet.xlsx"))
You have now bound your RadSpreadsheet using the Provider property at runtime: