AppliedRange: ITabRange;
AppliedRange: Prognoz.Platform.Interop.Tab.ITabRange;
The AppliedRange property determines the cell range with applied conditional formatting.
To set up conditional formatting, use the ITabFormatCellContent interface.
To get the list of formatting conditionsthat are used for a cell or cell range, use ITabRange.AppliedFormatConditions.
Executing the example requires a form with a set of components:
Button. The component implementing the button named Button1.
UiTabSheet. The component which is a data source for the TabSheetBox component, named UiTabSheet1. For Fore.NET example, use the uiTabSheetNet component.
TabSheetBox. The component displaying a table named TabSheetBox1. Select the UiTabSheet1 data source in the Source property for a component. For Fore.NET example, use the tabSheetBoxNet component.
Memo. The component that is a multisheet text editor named Memo1. For Fore.NET example, use the listBox component.
Add links for the Tab, Forms, Drawing, Forms.Net (for the Fore.NET example) system assemblies.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
TSheet: ITabSheet;
Range: ITabRange;
FormCond: ITabFormatCondition;
ValFormat: ITabFormatCellContent;
Style: ITabCellStyle;
Format: ITabFormatConditions;
Begin
// Add values to the table
TSheet:= UiTabSheet1.TabSheet;
TSheet.Cell(0, 0).Value := 5;
TSheet.Cell(1, 0).Value := 6;
TSheet.Cell(2, 0).Value := 2;
TSheet.Cell(3, 0).Value := 7;
// Select a column with added values
TSheet.View.Selection.SelectColumns;
// Add a conditional formatting for selected values
TSheet := TabSheetBox1.Source.GetTabSheet;
Range := TSheet.View.Selection.Range;
FormCond := Range.FormatConditions.Add;
FormCond.Type := TabConditionType.CellContent;
ValFormat := FormCond.Details As ITabFormatCellContent;
// Set the Cell Value Is Greater Than Five condition
ValFormat.ContentType := TabFormatContentType.CellValue;
ValFormat.ValueCondition := TabConditionCellContentValue.Above;
ValFormat.CellValue := 5;
// Create a style for cells where condition is applied
Style := New TabCellStyle.Create;
Style.BackgroundColor := GxColor.FromName("Yellow");
ValFormat.Style := Style;
// Determine addresses of cells where condition is applied
Format := Range.FormatConditions;
FormCond := Format.Item(0);
Memo1.Text := FormCond.AppliedRange.Address;
End Sub Button1OnClick;
Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.Tab;
Imports Prognoz.Platform.Interop.Forms;
Imports Prognoz.Platform.Interop.Drawing;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
TSheet: ITabSheet;
Range: ITabRange;
FormCond: ITabFormatCondition;
ValFormat: ITabFormatCellContent;
Style: ITabCellStyle;
Format: ITabFormatConditions;
GxColor: GxColorClass = New GxColorClassClass();
Begin
// Add values to the table
TSheet:= uiTabSheetNet1.TabSheetUi.TabSheet;
TSheet.Cell[0, 0].Value := 5;
TSheet.Cell[1, 0].Value := 6;
TSheet.Cell[2, 0].Value := 2;
TSheet.Cell[3, 0].Value := 7;
// Select a column with added values
TSheet.View.Selection.SelectColumns();
// Add a conditional formatting for selected values
TSheet := tabSheetBoxNet1.Source.GetTabSheet();
Range := TSheet.View.Selection.Range;
FormCond := Range.FormatConditions.Add();
FormCond.Type := TabConditionType.tctCellContent;
ValFormat := FormCond.Details As ITabFormatCellContent;
// Set the Cell Value Is Greater Than Five condition
ValFormat.ContentType := TabFormatContentType.tfctCellValue;
ValFormat.ValueCondition := TabConditionCellContentValue.tccvAbove;
ValFormat.CellValue := 5;
// Create a style for cells where condition is applied
Style := New TabCellStyle.Create();
Style.BackgroundColor := GxColor.FromName("Yellow");
ValFormat.Style := Style As TabCellStyle;
// Determine addresses of cells where condition is applied
Format := Range.FormatConditions;
FormCond := Format.Item[0];
listBox1.Items.Add(FormCond.AppliedRange.Address);
End Sub;
Clicking the button displays the conditional formatting for specified values in the table:
All values that are greater than five will be highlighted with yellow.
Addresses of cells where formatting condition is applied will be contained in the Memo (listBox) component.
See also: