DisplayZeroAs: String;
The DisplayZeroAs property determines text defined for cells with zero values.
Replacement of zero cells depends on access permissions to data contained in cells. Access permissions are determined using the TabAccessRights enumeration. Full access to data is used by default. If the ITabCellStyle.AccessRights property is set to TabAccessRights.NoAccess or TabAccessRights.Write, replacement of zero cells will be unavailable.
Executing the example requires a regular report with the REGULAR_REPORT identifier. The report can contain zeroes in random table cells.
Add links to the Metabase, Report and Tab system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
TabSheet: ITabSheet;
TRange: ITabRange;
Style: ITabCellStyle;
Begin
MB := MetabaseClass.Active;
// Get regular report
Report := MB.ItemById("REGULAR_REPORT").Edit As IPrxReport;
// Get table
TabSheet := (Report.ActiveSheet As IPrxTable).TabSheet;
// Set cell range
TRange := TabSheet.Cells(1,2,3,5);
// Replace zero cells with the specified value
Style:= TRange.Style;
Style.DisplayZeroAs:= "Zero";
// Save changes
(Report As IMetabaseObject).Save;
End Sub UserProc;
After executing the example, the cells that do not contain values in the C1:F3 range will display the Zero text.
See also: