Spread.NET v17 Service Pack 1 (17.1) has been released, and we've introduced several new features and enhancements that primarily focus on the Spread WinForms control.
Spread WinForms New Features
- Error Bar Support in Charts
- Column Style for Group Footers
- MultiOption CellType Compact Mode
- CellType Dialogs
- TabStrip Button Customization
- Double Click Fill Down
- Number Format for Status Bar
Ready to Check Out the Latest Release? Download Spread.NET Today!
Error Bar Support in Charts
Spread charts now support error bars for the following series types:
- Bar
- Line
- Area
- XYLine
- XYPoint
- ClusteredBar
- HighLowClose
- Candlestick
Various APIs have been added to support these:
fpSpread1.ActiveSheet.AddChart(new CellRange(0, 0, 3, 6), typeof(FarPoint.Win.Chart.ClusteredBarSeries), 600, 300, 50, 50);
fpSpread1.ActiveSheet.SetClip(0, 1, 1, 5, "1.2\t0\t-12.5\t-5\t15");
fpSpread1.ActiveSheet.SetClip(1, 0, 1, 6, "1\t-15.43\t-11\t16\t0\t17.5");
fpSpread1.ActiveSheet.SetClip(2, 0, 1, 6, "2\t7\t12\0\t-10\t10\t0");
if (fpSpread1.ActiveSheet.Charts[0].Model.PlotAreas[0].Series[0] is ClusteredBarSeries cluster)
{
foreach (BarSeries series in cluster.Series)
{
ErrorBars errorBar = series.SetErrorBarsVisible(true);
errorBar.ValueType = ErrorBarValueType.StandardError;
errorBar.Type = FarPoint.Win.Chart.ErrorBarType.Both;
}
}
Error bars are supported for import and export to XML and XLSX files and are also supported in the Spread Chart Designer:
For more information, see our Spread WinForms Error Bars documentation.
Column Style for Group Footers
In this new release, Column Styles can now be set on group footers. These can be set with the new IGroupFooterStyleSupport interface:
SheetView STestActiveSheet = fpSpread1.ActiveSheet;
STestActiveSheet.RowCount = 6;
STestActiveSheet.ColumnCount = 4;
STestActiveSheet.Cells[0, 0, 3, 0].Value = 1;
STestActiveSheet.Cells[4, 0, 5, 0].Value = 2;
STestActiveSheet.Cells[0, 2, 3, 2].Value = DateTime.Today;
DefaultGroupFooterCollection defaultGroupFooterCol = new DefaultGroupFooterCollection(6, 4);
DefaultGroupFooter defaultGroupFooter = defaultGroupFooterCol[0];
ISheetDataModel model = defaultGroupFooter.DataModel as ISheetDataModel;
(model as IAggregationSupport).SetCellAggregationType(0, 2, AggregationType.Avg);
TestFpSpread.ActiveSheet.DefaultGroupFooter = defaultGroupFooterCol;
GroupDataModel gdm = new GroupDataModel(STestActiveSheet.Models.Data);
STestActiveSheet.Models.Data = gdm;
gdm.Group(new SortInfo[] { new SortInfo(0, true) }, null);
TestFpSpread.ActiveSheet.GroupFooterVisible = true;
var style = new StyleInfo();
style.BackColor = System.Drawing.Color.LightBlue;
DateTimeCellType dt = new DateTimeCellType();
dt.DateTimeFormat = DateTimeFormat.UserDefined;
dt.UserDefinedFormat = "dd.MM.yyyy HH:mm:ss";
style.CellType = dt;
style.HorizontalAlignment = CellHorizontalAlignment.Left;
for (int i = 0; i < gdm.Groups.Count; i++)
{
var group = (Group)gdm.Groups[i];
group.GroupFooter.StyleManager.SetColumnStyle(2, style);
}
Check out the Spread WinForms Set Column Style in Group Footer documentation to learn more.
MultiOption CellType Compact Mode
The MultiOption CellType in Spread WinForms now supports a compact mode, which changes how a MultiOption CellType displays. This can be set with the new Compact property:
fpSpread1.ActiveSheet.Columns[0].Width = 200;
MultiOptionCellType cellType = new MultiOptionCellType();
cellType.Items = new string[] { "Diffuse", "A", "B" };
cellType.Compact = true;
cellType.Orientation = RadioOrientation.Horizontal;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = cellType;
See the Setting a Multiple Option Cell documentation for more details.
CellType Dialogs
The CellType Dialog has been updated internally to now use the built-in dialogue similar to the dialogs introduced in v17:
public static Form CellTypes(FpSpread spread, CellType.ICellType cellType);
TabStrip Button Customization
The behavior of TabStrip buttons can now be customized via the TabStrip.ButtonClick event. In the following example, the code changes the default functionality of the previous and next TabStrip buttons. Instead of horizontally scrolling through the Sheet tabs, it will now also set the next or previous sheet as Active:
fpSpread1.Sheets.Count = 8;
fpSpread1.TabStrip.ButtonClick += TabStrip_ButtonClick;
private void TabStrip_ButtonClick(object sender, TabStripButtonClickEventArgs e)
{
Debug.WriteLine($"TabStrip_ButtonClick. {sender}. {e.Button}");
if (e.Button == TabStripButton.Next)
{
fpSpread1.ActiveSheetIndex += 1;
}
else if (e.Button == TabStripButton.Previous)
{
fpSpread1.ActiveSheetIndex -= 1;
}
}
Read the Customize Tab Strip Behavior documentation for more detail.
Double Click Fill Down
Formulas in Spread .NET can now be filled down by double-clicking on the fill handle at the bottom right corner of a selected cell. Doing so will automatically copy the formula down to the end of your data, matching the rows in adjacent columns.
fpSpread1.ActiveSheet.Cells[0, 0].Value = 1;
fpSpread1.ActiveSheet.Cells[1, 0].Value = 2;
fpSpread1.ActiveSheet.Cells[2, 0].Value = 3;
fpSpread1.ActiveSheet.Cells[3, 0].Value = 4;
fpSpread1.ActiveSheet.Cells[4, 0].Value = 5;
fpSpread1.ActiveSheet.Cells[0, 1].Formula = "PRODUCT(A1,5)";
To learn more, see our Using Double Click to Fill Cells documentation.
Number Format for Status Bar
Numbers that appear in the Status Bar at the bottom of the Spread instance can now be formatted based on the same format as the active cell.
Ready to Check Out the Latest Release? Download Spread.NET Today!
Learn More About this .NET Spreadsheet Component
These are the main features that have been added to Spread.NET. Be sure to download a trial of Spread .NET to try out these features for yourself! Review the documentation to see the many available features, and download our demo explorer to see the features in action and interact with the sample code.