Skip to main content Skip to footer

Implement More Excel-like Features and Maintain Backwards Compatibility with Spread for WinForms 12

Spread.NET 12 for WinForms introduces new default behaviors that make the spreadsheet control easier to operate and more Excel-like by default.

Many user interactions are now enabled by default:

  • Cell range drag-and-drop
  • Cell range drag-fill
  • Sheet tab drag-and-drop to rearrange the ordering of the worksheets
  • Typing formulas in cells
  • Multiple range selection
  • Enhanced sort and filter context menus
New backwards compatibility: These new behaviors apply only to new instances created using Spread for WinForms 12.

New protect and locked defaults

Another important change switches the default values for the Protect property of the worksheets and the Locked property of the cells. To better match how Excel operates, the new default behavior sets the Protect property of the worksheets to FALSE and sets the Locked property of the cells to TRUE. (These defaults were reversed in previous versions.)

More Excel-like keyboard input mappings

Spread for WinForms 12 also introduces new default keyboard input mappings to make the user experience more Excel-like. The default keyboard input map for the spreadsheet control now applies the ExcelCompatibility input map that was included with earlier versions (and still installed to the bin folder with the components).

The newly supported key mapping for the [Alt] + [=] key combination invokes the new AutoSum Action. This action invokes edit mode in the active cell and automatically inserts a SUM formula referencing the adjacent cells above or to the left, if they contain number values.

Enhanced Calculation Engine

Spread.NET 12 features the new GrapeCity.CalcEngine calculation engine, which is designed to operate and calculate all functions and expressions much more like Excel, including array formulas and iterative calculations with circular references. The new calculation engine supports many enhancements, including external reference support and new external variables support, which allows the application to easily create a custom class to push or pull named values directly from the calculation engine.

Maintain automatic row height on Excel import and export

This release also introduces new automatic row height based on the font height and cell value, much like the automatic row height supported in Excel. This means you can import and export XLSX documents with automatic row heights and get the automatic row height adjustment when the user edits cells, same as in Excel.

New flat-style model operates more like Excel VSTO APIs

Spread.NET 12 brings a new flat-style model that operates more like Excel VSTO APIs. This new model—part of the new GrapeCity.Spreadsheet core spreadsheet model—optimizes performance for painting complex use cases involving many separate interrelated features, such as data binding, conditional formats, and camera shapes. Read more about the flat-style model enhancements and changes to the style-related API behavior.

What about backwards compatibility?

Don't worry – Spread.NET 12 won't break your upgraded projects! We've taken special care to ensure that upgraded projects continue to work as before. All the above described new behaviors apply only to new instances created using Spread for WinForms 12.

Legacy code generated using earlier releases of Spread.NET will continue to use the default constructor, which automatically initializes the control to support all legacy behaviors supported by previous releases.

New instances of the spreadsheet control created using Spread.NET 12 will use a new constructor and specify LegacyBehaviors:

Member Description
All All behaviors are compatible with previous version.
AutoRowHeight Row height won't be auto adjusted when cell's value or properties are changed on UI of Spread, all auto fit row height will be treated as custom row height
CalculationEngine Fallbacks to old behaviors of calculation engine.
None New behaviors will be applied automatically in new releases.
PropertyDefaults Initialized values of some properties will be different compared with previous versions.
Style All style default settings and behaviors will be compatible with previous version.

Upgraded instances of the spreadsheet control will use LegacyBehaviors.All, which enables each of the legacy behaviors for AutoRowHeight, CalculationEngine, PropertyDefaults, and Style. New instances of the spreadsheet control will specify None, which enables all new features available in Spread.NET 12.

You can change the LegacyBehaviors for upgraded instances in design time or by editing the project code and changing the LegacyBehaviors passed to the constructor. The LegacyBehaviors property is a design-time-only property that just determines which LegacyBehaviors are specified for the control's constructor in the generated code, except in the Spread Designer tool.

The Spread Designer tool defaults the LegacyBehaviors to None, like a new instance of Spread.NET 12 created in design-time, but the property is implemented in the Spread Designer as a regular run-time property so that you can change the LegacyBehaviors in the designer. Please note that changing the LegacyBehaviors in the Spread Designer still requires recreating the control instance, so this should be the first setting specified. This should only be used when you want to disable new feature support and import XML or XLSX files as in older versions of Spread.NET.

More about Spread.NET legacy behaviors

Four legacy behaviors can be enabled or disabled independently using the bit-flag enumeration LegacyBehaviors:

  • AutoRowHeight setting disables the automatic row height feature; row heights operate as in earlier releases.
  • CalculationEngine setting enables legacy behaviors in the calculation engine to calculate formulas as in earlier releases; functions that return date and time values will use the .NET DateTime type instead of double.
  • PropertyDefaults setting disables the new property default values that automatically enable many of the new default spreadsheet behaviors; properties such as AllowDragDrop, AllowDragFill, AllowUserFormulas, Protect, and Locked are initialized using the old default values.
  • Style setting disables the new flat-style model and instead uses the legacy-style models to draw the spreadsheet content; all code related to styles, StyleInfo, NamedStyle, DefaultSheetStyleModel and related classes like AlternatingRows will continue to operate as in previous releases.

To keep your upgraded projects running as in older versions of Spread, you do not need to do anything special; your upgraded projects should use LegacyBehaviors.All, and continue to operate as before. However, upgraded projects will not use the new flat-style model, and some features like gradient fills and pattern fills will not be supported.

You can change the LegacyBehaviors for upgraded instances of the spreadsheet control in design-time using the property grid. If your code for the upgraded spreadsheet instance uses old style-related APIs (such as AlternatingRow.BackColor, Column.Font, Row.TextIndent, or Cell.ForeColor), or calculations expecting DateTime values for custom functions, then some porting of the code-behind may be required when changing the LegacyBehaviors. In that case, please refer to the flat-style WinForms model and how to transition code from using the old hierarchical style model to using the new flat-style model instead.

Download Now!<%/if%>

Sean Lawyer

Sean Lawyer

Product Manager
comments powered by Disqus