The premier spreadsheet control for Windows developers is getting a couple of much-requested features for v14.2: data grouping, and filtering of data using the AutoFilter feature. Let’s see what these involve.
One of the biggest new features of our WinForms, WPF, and ASP.NET datagrids in v14.2 is the ability to export data from the grid to an XLS/XLSX file and maintain the grouping and sorting currently configured in the grid. The requirement is to allow end-users to group, sort, filter data within the grid, export the result to an XLSX file, and then open up that file in Excel to continue analyzing that data. All grouping, sort orders and filtering options transfer to the XLSX file and the user is given a similar look to the data within Excel. See here for details on this new functionality.
Well, anything Excel can do our spreadsheet controls should be able to do too, and with v14.2 we’ve added data grouping to the control.
You can group data by using the corresponding commands of the Outline group on the Data tab on the corresponding ribbon.
There are several options here:
- The Group command allows the user to group related rows or columns manually.
- The Auto Outline command creates an automatic outline, based on the subtotal and summary formulas contained in the user’s document.
- The Ungroup/Clear Outline command, unsurprisingly, ungroups previously created groups.
- The Subtotal command automatically calculates subtotals for the related rows and displays summaries above or below the detail rows.
For the latter command, a dialog is displayed allowing the user to configure the subtotals and options needed:
Once the user has organized their data into groups, they can collapse a group and temporarily hide rows or columns to show only the significant data, or expand it again to reveal the hidden data. To collapse or expand the group, the user clicks the corresponding minus or plus icon:
The spreadsheet control goes even further: it publishes a new function, SUBTOTAL(), to give your users even more control over their summary data. The first argument defines the function code that specifies the function to be used in calculating subtotals (SUM, COUNT, AVERAGE, etc.) and whether the hidden values in collapsed groups should be taken into account during calculations. This is the direct equivalent of the Excel SUBTOTAL function.
(Here, for example, the function code 9 corresponds to SUM.)
Of course, all these features are also available via the spreadsheet control API. You can group data programmatically by using the Group() and AutoOutline() methods for the specified rows, columns, or the entire document. To automatically create subtotals for the range, you use the Worksheet.Subtotal() or RangeExtention.Subtotal() methods.
With v14.2, we have added a new powerful filtering feature to the WinForms and WPF spreadsheet controls. Using the AutoFilter functionality, your users can analyze large amounts of data by displaying only those rows that meet some filtering criteria. Applying such a filter is quite simple: the user just needs to select the required data and then click the Filter button in the Sort & Filter ribbon group.
Once filtering is activated, a down-arrow icon appears on the right side of each column header. The user clicks this icon for each required column to select the filter type they wish to use: Text Filters, Number Filters, or Filter by Values. The user can use the built-in comparison operators, or specify their own custom criteria in the Custom AutoFilter dialog box.
If needed, the user can sort the filtered data in ascending or descending order.
With v14.2 we are enhancing the WinForms and WPF spreadsheet controls to include even more data analysis features: sorting, grouping and filtering. We hope you and your users will delight in these new features. Please let me know below what you think of them.