Class Slice
Namespace: FastReport.Olap.Slice
Assembly: FastCube.Core.dll
The slice component.
public class Slice : Component
Inheritance
object ← MarshalByRefObject ← Component ← Slice
Constructors
Slice()
Creates a new default instance.
public Slice()
Slice(IContainer)
Creates a new instance.
public Slice(IContainer container)
Parameters
container
IContainer
Properties
AutoUniqueValuesFilter
Gets or sets auto unique falue filter.
public bool AutoUniqueValuesFilter { get; set; }
Property Value
BindCaptionWidth
Gets or sets whether to bind field width and field caption width for all fields of XAxis and YAxis Can be changed in code for each axis/field independently
public bool BindCaptionWidth { get; set; }
Property Value
CodeDesigner
Reference to Code editor
[Browsable(false)]
public ICodeDesigner CodeDesigner { get; }
Property Value
CodeErrors
Gets code errors collection.
[Browsable(false)]
public CodeErrorCollection CodeErrors { get; }
Property Value
ColCount
Gets data column count
[Browsable(false)]
public int ColCount { get; }
Property Value
Cube
Reference to Cube
public Cube Cube { get; set; }
Property Value
DefaultColumnWidth
Default column width for grids
public int DefaultColumnWidth { get; set; }
Property Value
DefaultPopupWidth
Default popup window width for grids
public int DefaultPopupWidth { get; set; }
Property Value
DefaultRowHeight
Default row height for grids
public int DefaultRowHeight { get; set; }
Property Value
Dimensions
List of known Dimensions to access them in Script/Expressions
[Browsable(false)]
public Dimensions Dimensions { get; }
Property Value
FieldsOrder
Gets or sets order of fields.
public FieldComparerType FieldsOrder { get; set; }
Property Value
FilterManager
Reference to filter manager
public FilterManager FilterManager { get; set; }
Property Value
FiltersContainer
Reference to Filters
[Browsable(false)]
public FiltersContainer FiltersContainer { get; }
Property Value
HideColZeros
Gets or Sets whether to hide columns only with empty or zero cells
public bool HideColZeros { get; set; }
Property Value
HideRowZeros
Gets or Sets whether to hide rows only with empty or zero cells
public bool HideRowZeros { get; set; }
Property Value
HideTotalForSingleValue
Gets or Sets whether to hide totals for single value blocks
public bool HideTotalForSingleValue { get; set; }
Property Value
Measures
List of known Measures to access them in Script/Expressions
[Browsable(false)]
public Measures Measures { get; }
Property Value
MeasuresContainer
Reference to Measures
[Browsable(false)]
public MeasuresContainer MeasuresContainer { get; }
Property Value
ReferencedAssemblies
Gets or sets an array of assembly names that will be used to compile the slice script.
[SRCategory("Script")]
[Browsable(false)]
public string[] ReferencedAssemblies { get; set; }
Property Value
string[]
Remarks
By default this property contains the following assemblies: "System.dll", "System.Drawing.dll", "System.Windows.Forms.dll", "System.Data.dll", "System.Xml.dll". If your script uses some types from another assemblies, you have to add them to this property.
Since version 2025.1, this property is deprecated and no longer used, read the release notes.
RowCount
Gets data row count
[Browsable(false)]
public int RowCount { get; }
Property Value
ScriptLanguage
Gets or sets the script language.
[SRCategory("Script")]
public Language ScriptLanguage { get; set; }
Property Value
Remarks
Note: changing this property will reset the report script to default empty script.
ScriptText
Gets or sets the slice script.
[Browsable(false)]
public string ScriptText { get; set; }
Property Value
Remarks
The script contains the SliceScript class that contains all slice objects' event handlers and own items such as private fields, properties, methods etc. The script contains only items written by you.
By default this property contains an empty script text.
Security note: since the script is compiled into .NET assembly, it allows you to do ANYTHING. For example, you may create a script that will read/write files from/to a disk.
SelectedCol
Get active column for grid
[Browsable(false)]
public int SelectedCol { get; }
Property Value
SelectedRow
Get active row for grid
[Browsable(false)]
public int SelectedRow { get; }
Property Value
SliceFields
Collection of Slice fields
[Browsable(false)]
public SliceFields SliceFields { get; }
Property Value
TopNs
Reference to TopN collection
[Browsable(false)]
public TopNs TopNs { get; }
Property Value
XAxisContainer
Reference to X Axis
[Browsable(false)]
public AxisContainer XAxisContainer { get; }
Property Value
YAxisContainer
Reference to Y Axis
[Browsable(false)]
public AxisContainer YAxisContainer { get; }
Property Value
Methods
BeginUpdate()
Start change operation
public void BeginUpdate()
Calc(Expression)
Calculates an expression and returns the result.
public object Calc(Expression expression)
Parameters
expression
Expression
The expression to calculate.
Returns
If script is already compiled, returns the result of calculation. Otherwise returns null.
Remarks
The expression may be any valid expression such as "1 + 2". The expression is calculated in the slice script's SliceScript class instance context, so you may refer to any objects available in this context: private fields, methods, report objects.
Calc(Expression, object)
Calculates an expression and returns the result.
public object Calc(Expression expression, object value)
Parameters
expression
Expression
The expression to calculate.
value
object
The value of currently building object.
Returns
If script is already compiled, returns the result of calculation. Otherwise returns null.
Remarks
Do not call this method directly. Use the Calc(string expression) method instead.
CalcExpression(Expression, object)
Returns an expression value.
protected virtual object CalcExpression(Expression expression, object value)
Parameters
expression
Expression
The expression.
value
object
The value of currently printing object.
Returns
Returns the result of calculation.
Remarks
This method is for internal use only, do not call it directly.
CalcFuncForSelectedArea(AggregateFunction, Selection)
Calculate aggregate for a region
public object CalcFuncForSelectedArea(AggregateFunction aggregateFunction, Selection selection)
Parameters
aggregateFunction
AggregateFunction
Aggregate function
selection
Selection
Cell selection
Returns
Calculated value
Clear()
Clear slice. Remove all fields from containers.
public void Clear()
ColRowToDataCellPos(int, int, ref MeasureCellBSPosition)
Converts column and row coordinates to MeasureCellBSPosition structure
public bool ColRowToDataCellPos(int col, int row, ref MeasureCellBSPosition measureCellBSPosition)
Parameters
col
int
column
row
int
row
measureCellBSPosition
MeasureCellBSPosition
reference to MeasureCellBSPosition structure
Returns
False - fail, True - success
Dispose(bool)
Releases the unmanaged resources used by the System.ComponentModel.Component and optionally releases the managed resources.
protected override void Dispose(bool disposing)
Parameters
disposing
bool
true to release both managed and unmanaged resources; false to release only unmanaged resources.
EndUpdate()
Finish change operation
public void EndUpdate()
FindSliceFieldInContainers(SliceField, out SliceContainerType)
Searches Filters, XAxis, YAxis for a SliceField
public int FindSliceFieldInContainers(SliceField sliceField, out SliceContainerType sliceContainerType)
Parameters
sliceField
SliceField
SliceField to find
sliceContainerType
SliceContainerType
Output container type where field is found or None
Returns
Output field position in container or -1
GetChartData(ChartParams, SliceChartDataHandler)
Fills chart data.
public void GetChartData(ChartParams chartParams, SliceChartDataHandler handler)
Parameters
chartParams
ChartParams
handler
SliceChartDataHandler
GetColWidth(int)
Get column width (for grid)
public int GetColWidth(int columnIndex)
Parameters
columnIndex
int
column index
Returns
width
GetDetailOrderedRecordSet(int, int)
Get detail recordset for cell
public DetailOrderedRecordSet GetDetailOrderedRecordSet(int col, int row)
Parameters
col
int
cell column
row
int
cell row
Returns
DetailOrderedRecordSet
GetHierarchicalData(HierarchicalDataParams, SliceHierarchicalDataHandler)
Fills hierarchical data.
public void GetHierarchicalData(HierarchicalDataParams hierarchicalDataParams, SliceHierarchicalDataHandler handler)
Parameters
hierarchicalDataParams
HierarchicalDataParams
handler
SliceHierarchicalDataHandler
GetMeasureCell(int, int)
Get Measure cell information by coordinates
public MeasureCell GetMeasureCell(int col, int row)
Parameters
col
int
Column
row
int
Row
Returns
MeasureCell structure
GetMeasureValue(int, int)
Get Measure value at position
public object GetMeasureValue(int ACol, int ARow)
Parameters
ACol
int
column
ARow
int
row
Returns
measure value
GetMeasureValueCaption(int, int)
Get Measure text at position
public string GetMeasureValueCaption(int ACol, int ARow)
Parameters
ACol
int
column
ARow
int
row
Returns
measure text
GetRowHeight(int)
Get row height (for grid)
public int GetRowHeight(int rowIndex)
Parameters
rowIndex
int
row index
Returns
height
InternalInit()
Initializes the slice's fields.
protected void InternalInit()
Remarks
This method is for internal use only.
InvokeEvent(string, object[])
Invokes the script event handler with given name.
public void InvokeEvent(string name, object[] parms)
Parameters
name
string
The name of the script method.
parms
object[]
The method parameters.
IsValidDimension(string)
Checks if dimension exists in the list of known dimensions
public bool IsValidDimension(string name)
Parameters
name
string
Dimension name
Returns
True if dimension is known
IsValidField(string)
Checks if slice field exists in the list of known slice fields
public bool IsValidField(string name)
Parameters
name
string
Field name
Returns
True if field is known
IsValidMeasure(string)
Checks if measure exists in the list of known measures
public bool IsValidMeasure(string name)
Parameters
name
string
Measure name
Returns
True if measure is known
Load(string)
Load from file
public bool Load(string fileName)
Parameters
fileName
string
File name
Returns
True - success
Load(XmlDocument)
Load from XML
public bool Load(XmlDocument doc)
Parameters
doc
XmlDocument
XML document
Returns
True - success
Load(Stream)
Load from stream
public bool Load(Stream stream)
Parameters
stream
Stream
Stream
Returns
True - success
Save(string, SliceSaveExtras)
Save to file
public void Save(string fileName, SliceSaveExtras extras = SliceSaveExtras.None)
Parameters
fileName
string
File name
extras
SliceSaveExtras
Extra items to save
Save(XmlDocument, SliceSaveExtras)
Save to XML
public void Save(XmlDocument doc, SliceSaveExtras extras = SliceSaveExtras.None)
Parameters
doc
XmlDocument
XML document
extras
SliceSaveExtras
Extra items to save
Save(Stream, SliceSaveExtras)
Save to stream
public void Save(Stream stream, SliceSaveExtras extras = SliceSaveExtras.None)
Parameters
stream
Stream
Stream
extras
SliceSaveExtras
Extra items to save
SendAlert(SliceAlertEventArgs)
Invokes the alert event.
protected void SendAlert(SliceAlertEventArgs alert)
Parameters
alert
SliceAlertEventArgs
SetColWidth(int, int)
Set column width (for grid)
public void SetColWidth(int columnIndex, int value)
Parameters
columnIndex
int
column index
value
int
width
SetColsWidth(int)
Set all columns width to value (for grid)
public void SetColsWidth(int value)
Parameters
value
int
width
SetRowHeight(int, int)
Set row height (for grid)
public void SetRowHeight(int rowIndex, int value)
Parameters
rowIndex
int
row index
value
int
height
SetRowsHeight(int)
Set all rows height to value (for grid)
public void SetRowsHeight(int value)
Parameters
value
int
height
SetTotalPosition(TotalPosition)
Set total position for all levels in all axis
public void SetTotalPosition(TotalPosition totalPosition)
Parameters
totalPosition
TotalPosition
Transpose()
Transpose slice - change axis (X axis become Y axis and vice versa)
public void Transpose()
AlertEventHandler
Event for allert.
public event SliceAlertEventHandler AlertEventHandler
Event Type
OnAfterAddSliceFieldToContainer
Event on after added slice field to container.
public event SliceFieldContainerChangedEventHandler OnAfterAddSliceFieldToContainer
Event Type
SliceFieldContainerChangedEventHandler
OnBeforeAddSliceFieldToContainer
Event on before adding slice field to container.
public event SliceFieldContainerChangeEventHandler OnBeforeAddSliceFieldToContainer
Event Type
SliceFieldContainerChangeEventHandler
OnBeforeRemoveSliceFieldFromContainer
Event on before removing slice field from container.
public event SliceFieldContainerChangeEventHandler OnBeforeRemoveSliceFieldFromContainer