WinForms.Spreadsheet: Apply Conditional Formatting

In this blog we will discuss how to apply conditional formatting to a range of cells in MindFusion.Spreadsheet for WinForms. Conditional formatting is a feature that allows you to apply different formatting options, such as background color, borders, or font to cells that meet certain criteria and have this formatting automatically change depending on the value or formula of the cell.

Introduction

We start off by creating a new Windows Forms Application in Visual Studio and adding a WorkbookView control to the main form. The WorkbookView displays a Workbook with a single worksheet.

Initializing the data

The goal of the application is to display an array of temperature values, colored differently based on a standard temperature scale. The data of the application is hard-coded in several arrays, which are used to initialize the worksheet:

var names = new CultureInfo("en-US").DateTimeFormat.AbbreviatedMonthNames;
var avgHigh = new int[] { 4, 7, 12, 17, 21, 25, 28, 28, 23, 18, 10, 4 };
var avgLow = new int[] { -5, -4, 0, 5, 9, 13, 14, 14, 10, 6, 0, -4 };
var recordHigh = new int[] { 16, 17, 24, 28, 29, 32, 37, 34, 34, 30, 24, 17 };
var recordLow = new int[] { -21, -19, -15, -5, -1, 4, 7, 8, -2, -2, -7, -16 };

Applying the conditional formatting

In MindFusion.Spreadsheet conditional formatting is applied to a range of cells through its style. This is done by calling the Style.ConditionalFormats.Add method to create IConditionalFormat objects and then setting the properties of the newly created object to specify the condition criteria and the style to apply when the criteria are met. In this application we use a simple algorithm to distribute temperature values linearly along a blue-yellow-red color scale. When a cell value falls within a specific temperature interval, the conditional formatting applies a background color to this cell to visually indicate the value.

The following image shows the running sample:

spreadsheet-conditionalformats

Conditional formatting can also be created and modified through the built-in ConditionalFormatForm form, contained in the MindFusion.Spreadsheet.WinForms.StandardForms.dll assembly. The image below displays the form for the temperature cell range.

spreadsheet-conditionalformatform

The source code is available for download from here:

https://mindfusion.eu/_samples/SpreadsheetConditionalFormats.zip

The trial version of MindFusion.Spreadsheet for WinForms can be downloaded from here:

Download MindFusion.Spreadsheet for WinForms Trial Version

About MindFusion.Spreadsheet for WinForms: A powerful .NET spreadsheet component with great capabilities for editing, styling and formatting large amounts of data.

Spreadsheet for WinForms, V1.1 Released

MindFusion has released Spreadsheet for WinForms 1.1. Here is an overview of the new features:

Export to XLSX (Office Open XML) format
You can use the new ExcelExporter class to export MindFusion.Spreadsheet Workbook objects to Excel. The export is very easy to do – just create an instance of the ExcelExporter class and call its Export method, passing the Workbook object as a parameter.

Export to ODS (OpenDocument Spreadsheet) format
You can now export MindFusion.Spreadsheet Workbook objects to the OpenDocument format. To export a workbook, simply create an instance of the new CalcExporter class and call its Export method, passing the Workbook object as a parameter.

Moving cell ranges
You can now move cells and cell ranges both programmatically and interactively. To move a cell range programmatically, call one of the MoveTo overloads of a CellRange object representing the range to move and specify the destination. To move a range interactively, select the range, click near the end of the selection rectangle and drag the rectangle to the desired location. If you want to disable interactive movement set the AllowMoveCells property of the WorkbookView class to false.

Rows, columns and cell ranges can be moved either programmatically or interactively with the mouse.

Rows, columns and cell ranges can be moved either programmatically or interactively with the mouse.

Moving rows and columns
You can move columns and rows programmatically as well interactively. To move a column/row programmatically, call one of the Move overloads of the ColumnCollection or RowCollection classes respectively, and specify the column/row to move and the desired location. To move columns or rows interactively, select the columns or rows entirely, click on any of the selected column or row headers and drag.

Find and replace
The workbook now provides a set of methods for searching and replacing text. You can search text with the Find and FindAll methods. The former searches for the first cell containing a given text, the later returns all cells matching the criteria. To replace text, use the Replace and ReplaceAll methods.

Improved in-place editing
You can use the extended in-place formula editing, which supports automatic literal, string, cell and cell range coloring and context-sensitive tooltip information for functions. The information for custom functions can be provided through the new ExtendedInformationProvider property of the Workbook class.

You can download the trial version from the link below:

Download MindFusion.Spreadsheet for WinForms 1.1, Trial Version

If you require technical support, you can post a message at the forum, send us an e-mail at support@mindfusion.eu. or use the help desk. MindFusion takes special effort in providing fast and detailed answers to all inquiries that we receive.

About MindFusion.Spreadsheet for WinForms: An easy-to-use programming component suitable for building all types of spreadsheets fast and easy. The tool supports formulas, tool-tips, cell annotations, cell spanning, scrolling and many more. You can add charts and images as well use the flexible style system to design the perfect spreadsheet. The component supports full undo and redo as well copy and paste from Windows clipboard.
You can import spreadsheet data from CSV, XLSX or ODS files and export the final spreadsheet in a number of formats – as images, PDF or CSV, XLSX or ODS files. Various auxiliary forms help you quickly adjust the data and appearance of your spreadsheet. Read more about the features of the component here or check the license prices at the buy page.

Spreadsheet for WinForms is part of MindFusion Pack for WinForms, which offers other useful components that are of great use when you build any type of WinForms application – from a diagramming library to map control to gauges: check them here.

Diagramming for Java, V4.0.5 Released

MindFusion has released a new version of its Diagramming library for Java. Here is an overview of the new features:

Resize of multiple nodes

The new version lets you resize multiple nodes simultaneously – just call Diagram.setAllowMultipleResize(true) to enable it. When enabled, dragging a corner or side adjustment handle of any node resizes all nodes in the selection.

Multiple selection of nodes.

Multiple selection of nodes.

VisioImporter Improvements

  • The Item argument of the VisioImportListener.importItem event handlers is now pre-set to a
    DiagramItem instance created for the imported Visio shape, letting you avoid parsing some standard data such as Bounds or Text.
  • A few bugs have been fixed

ZoomControl Improvements

  • Changing DiagramView.ZoomFactor now automatically updates the zoom control slider
  • the pan widget now fills the ZoomControl width or height instead of having fixed size.
  • setting ZoomControl’s width larger than its height makes the zoom slider horizontal.

We have also made a few API changes – read details here. The trial version is available for download from the following link:

Download MindFusion.Diagramming for Java Swing, V4.0.5 Trial

Technical support

MindFusion puts special effort in providing high quality technical support to all its clients and evaluators. You can post your questions about Diagramming for Java or any other of our components at the forum, help desk or at support@mindfusion.eu. All support inquiries are usually answered within hours of being received.

About Diagramming for Java Swing: MindFusion.Diagramming for Java Swing provides your Java application with all necessary functionality to create and customize a diagram. The library is very easy to integrate and program. There are numerous utility methods, rich event set, more than 80 predefined shapes. The tool supports a variety of ways to render or export the diagram, advanced node types like TreeView nodes, hierarchical nodes, tables, container nodes and many more. There are 15 automatic layouts, various input / output options and fully customizable appearance. A detailed list with JDiagram’s features is uploaded here. You can check the online demo to see some of the functionality implemented.

Diagramming for Java Swing is royalty free, there are no distribution fees. Licenses depend on the count of developers using the tool – check here the prices.

Diagramming for ActiveX 4.8

MindFusion has released a new version of Diagramming for ActiveX programming component. Below is a list of the new features:

Multiple labels per arrow

You can use the ArrowLabels class to show multiple captions at a single Arrow object. The appearance and format of the labels are fully customizable – use the Text, Font, TextColor, EnableWrap, MaxWidth, Margin properties to specify how your caption looks. There are various properties for setting the position of the label – RelativeTo, Index, HorizontalAlign, VerticalAlign, HorizontalOffset, VerticalOffset. The RelativeTo property lets you bind labels to a specific control point or segment specified by Index, or to a percent of the arrow’s Length.

Labels at diagram links.

Labels at diagram links.

In-place editting of arrow’s text

The new AllowInplaceEdit property allows users to edit an arrow’s caption interactively – they just need to double click an Arrow object or an ArrowLabel. Programmatically, the arrow’s caption can be edited by calling the BeginInplaceEdit(label) method with null/nothing as an argument.

New Stock Shapes

You can now use the new set of predefined node shapes – RightTriangle, Decagon, Trapezoid, Star4Pointed, Star5Pointed, Star6Pointed, Star7Pointed, Star16Pointed, Star24Pointed, Star32Pointed, Donut and Plaque. You can read further details about the new features and this release of FlowChartX at the news section of the forum. The trial version of the control is available for download from here:

Download FlowChartX 4.8 Trial Version

Technical support

MindFusion puts special effort in providing excellent customer support to all developers who use our components. You can write at the forum, help desk or use e-mail support@mindfusion.eu. All questions are usually answered within hours of being received.

About MindFusion.Diagramming for ActiveX: An ActiveX programming component that lets you create with ease every type of diagram, flowchart, scheme, chart, hierarchy, tree etc. The control supports rich user interaction model with advanced features like tool tips, grid alignment, docking points for nodes, scrolling and zooming and many more. FlowChartX implements 7 automatic layouts as well arrow routing. The appearance if each flowchart is completely customizable. Nodes can hold both images and text, their Z-order can be changed and there are tens of predefined shapes to choose from. Nodes support aero and glass visual effects.

The control also includes detailed documentation and many samples for a variety of languages and
platforms. You can find more about the features of the tool at the features page or check the licensing scheme and the prices here.

Diagramming for ASP.NET, V5.0.5

MindFusion has just released a new version of Diagramming for ASP.NET programming component. Below is a list of the improvements we have made to the component:

Canvas mode improvements

  • RoundedLinks and RoundedLinksRadius properties are now supported in Canvas mode.
  • LinkCrossings and CrossingRadius properties are now supported in Canvas mode.
  • Behavior.Pan is now supported in Canvas mode.

Visio2013Importer improvements

  • The Item argument of ImportItem event handlers is now pre-set to a DiagramItem instance created for the imported Visio shape, letting you avoid parsing some standard data such as Bounds or Text. You can either modify this item’s properties, or replace it with a new instance of a different type.
  • a few bugs have been fixed

flowchart_blog

Detailed information about the release is posted at the forum. Below is a link to download the trial version:

Download MindFusion.Diagramming for ASP.NET 5.0.5 Trial Version

Technical support

MindFusion support team is happy to assist you with any questions you might have about Diagramming for ASP.NET or any other of our products. You can leave a message at the discussion board, use the help desk or e-mail support@mindfusion.eu.. We strive to provide competent and detailed answers to your questions within hours of receiving them.

About Diagramming for ASP.NET: An advanced WebForms programming component that offers all the functionality that is needed for creating, styling and presenting attractive flowcharts, hierarchies, trees, graphs, schemes, diagrams and many more. The control offers numerous utility methods, path finding and cycle detection, rich event set and many useful user interaction features like tool tips, multiple selection, copy/paste to/from Windows clipboard and many more.

NetDiagram offers over 100 predefined node shapes, scrollable tables, 13 automatic layouts and many more. You can check the online demo to see some of the features in action. The control includes many samples, detailed documentation and step-by-step tutorials. Every features is duly documented and there’s plenty of code to copy. The component is not only powerful and scalable, but easy to learn and fun to use.