Telerik blogs
The first release of 2013 is already a fact and as you may already know it brings some exciting new additions to our WPF and Silverlight suites. One of them is our long-awaited spreadsheet component. If you wonder what it would be like, what you are to do with it, this blog post may just be the answer to your questions. So let me introduce to you RadSpreadsheet.


This is how it looks with our new Windows8 theme applied. Needless to say, it supports all Themes in the pack of themes for RadControls, in order to make it easier for you to integrate it in any RadControls Application.

What is RadSpreadsheet?

RadSpreadsheet is a control that allows editing tabular data utilizing a variety of cell formatting options, styles and themes.  It can contain one or more Worksheets, each of which with its own Scale Factor and Undo/Redo stack. Handy, huh?

Every worksheet contains cells that are identified by a row number (rows are represented by numbers - 1, 2, 3) and a column number (columns are represented by letters of the alphabet in the UI).

What can I do with the worksheet and its cells?

You can input numbers, text or formulas in a cell. You can format numbers in one of the following categories:

  • Number
  • Currency
  • Accounting
  • ShortDate
  • LongDate
  • Time
  • Percent
  • Fraction
  • Scientific
  • Text
  • Custom

This is very helpful when you want to represent for example Financial Data - keeping track of investments, creating budgets, etc. The date formats will facilitate you to represent different periods of time and accounting formats will let you specify amounts in various currencies effortlessly.

Formulas are built-in functions that you can use by prepending the equals sign (=) to the string you input in a cell and then inputting the name of a function. There are functions that accept different number of parameters such as “SUM(argument1, argument2, …)”, as well as ones that do not require you to input any parameters, like “DATE()” . You can perform miscellaneous calculations on the values of any range of cells and display the result as a Formula in a selected cell. This is very convenient when you want RadSpreadsheet to calculate the sum of all cells in a column and show it as “Total”.

Other cool features are the Auto fill and the Series which fill cells automatically with data following a specific pattern. They provide a wide variety of options for lazy people such as developers to populate cells with the same content or functional series like:

  1. Sequential numbers: 1, 2, 3, …;
  2. Successive months: Jan, Feb, Mar, …;
  3. Dates and times: 10:00, 11:00, 12:00… and many others.

So much for the data in the cells, how about some color and motion?

You can modify many more different properties of the cells and the worksheet to make them look according to your liking. Here are some of the things you can do with our new control:

  • Insert and delete cells, rows and columns
  • Merge/Unmerge cells
  • Resize rows/columns
  • Change cell’s look & feel
    • Various fonts and font sizes
    • Fore color and background color
    • Bold, italics and underline
    • Vertical and horizontal cell alignment
    • Text wrapping
    • Cell borders
    • Cell styles and themes
  • Different scrolling modes – ItemBased and PixelBased
  • Zoom in/zoom out.

Here is how the spreadsheet looks with some cell values and formatting applied as well as different fonts, backgrounds and styles set.



Show me the code

Here is the simplest possible XAML definition of RadSpreadsheet:

<telerik:RadSpreadsheet x:Name="radSpreadsheet" />

 

Now maybe you are wondering how to get to a cell’s properties and possibly change some of them. Well, let’s see:

Actions connected with formatting are performed over a CellSelection. Here is the code which retrieves a cell selection that includes the cell that resides in row 0, column 1:

CellSelection cell = this.radSpreadsheet.Workbook.ActiveWorksheet.Cells[0, 1];

 
After that, getting its properties is pretty straight forward:

ICellValue value = cell.GetValue().Value;
CellValueFormat format = cell.GetFormat().Value;
bool isBold = cell.GetIsBold().Value;

If you want to change those, you can do it as follows:

cell.SetValue("123");
cell.SetFormat(new CellValueFormat("#,##0.00"));
cell.SetIsBold(true);

What about export/import? 

We support three formats which you can use to persist your data in. Here they are:

  • XLSX – Microsoft Office Open XML Spreadsheet format – preserves rich text formatting;
  • CSV – comma separated values - a plain text format, preserving the distribution among cells;
  • TXT – tab separated plain text – a plain text version of the document, using tab as a delimiter between cells.

NOTE:
Both CSV and TXT are plain text formats. Thus, the distribution of the document content in cells will be kept, but

the formatting will be lost.

When can I see it and try it out?

RadSpreadsheet is available with our Q1 2013 release. You can check the Silverlight demo of the control and the click-once Telerik WPF examples. We hope you like it!

In any case, don’t forget that it is only a community technical preview and there is much more to come in the future months, so stay tuned in Telerik forums and blogs. Releasing the component at a CTP state means that we now, more than ever, need your feedback to evaluate what features to implement to better meet yours and your customers’ needs.

Last but not least, RadSpreadsheet is not the only new supplement to the RadControls suite for this release. You can check out the other exciting additions here.


About the Author

Andrey Andreev

Software Developer,
Centaur Team

Related Posts

Comments

Comments are disabled in preview mode.