New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Understanding Telerik AJAX and Document Processing Library Spreadsheet Workbook and Worksheets


The assemblies from the Telerik UI for ASP.NET AJAX(later referred as AJAX) suite and Document Processing Library(later referred as DPL) both have Workbook and Worksheet classes which are different and with different capabilities.

Converting from One to Another

The Workbook and worksheets from the AJAX and DPL are not interchangeable. Nevertheless, the AJAX Workbook class has some methods that allow converting from one to another and vice-versa:

  • An instance method .ToDocument() that all allows any AJAX Workbook instance to be converted to a DPL Workbook;
  • A static method Workbook.FromDocument() that allows any DPL Workbook to be converted to an AJAX Workbook;
using System;
using DPL = Telerik.Windows.Documents.Spreadsheet.Model;
using AJAX = Telerik.Web.Spreadsheet;
using System.Collections.Generic;
// AJAX to Document Processing Library
AJAX.Workbook ajaxWorkbook = new AJAX.Workbook();
AJAX.Worksheet ajaxWorksheet = ajaxWorkbook.AddSheet();

AJAX.Row row = new AJAX.Row() { Index = 2, Cells = new List<AJAX.Cell> { } };
row.AddCell(new AJAX.Cell() { Index = 2, Value = "Test cell" });

DPL.Workbook dplWorkbook = ajaxWorkbook.ToDocument();
DPL.Sheet dplSheet = dplWorkbook.Sheets[0];
DPL.Worksheet dplWorksheet =  dplWorkbook.Worksheets[0];

// Document Processing Library to AJAX
AJAX.Workbook convertedAjaxWorkbook = AJAX.Workbook.FromDocument(dplWorkbook);
AJAX.Worksheet convertedAjaxWorksheet = convertedAjaxWorkbook.Sheets[0];

// value is "Test cell"
string value = convertedAjaxWorksheet
    .Rows.Find(r=> r.Index == 2)
    .Cells.Find(c=> c.Index == 2)
In this article