Class Slice
Inheritance
Namespace: FastReport.Olap.Slice
Assembly: FastReport.Olap.dll
Syntax
[ToolboxBitmap(typeof(Slice), "Resources.Slice.bmp")]
public class Slice : Component, IComponent, IDisposable
Constructors
Slice()
Declaration
public Slice()
Slice(IContainer)
Declaration
public Slice(IContainer container)
Parameters
| Type | Name | Description |
|---|---|---|
| System.ComponentModel.IContainer | container |
Properties
AutoUniqueValuesFilter
Declaration
public bool AutoUniqueValuesFilter { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
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
Declaration
public bool BindCaptionWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
CodeDesigner
Reference to Code editor
Declaration
[Browsable(false)]
public Designer CodeDesigner { get; }
Property Value
| Type | Description |
|---|---|
| Designer |
CodeErrors
Declaration
[Browsable(false)]
public CodeErrorCollection CodeErrors { get; }
Property Value
| Type | Description |
|---|---|
| CodeErrorCollection |
ColCount
Gets data column count
Declaration
[Browsable(false)]
public int ColCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Cube
Reference to Cube
Declaration
public Cube Cube { get; set; }
Property Value
| Type | Description |
|---|---|
| Cube |
DefaultColumnWidth
Default column width for grids
Declaration
public int DefaultColumnWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
DefaultPopupWidth
Default popup window width for grids
Declaration
public int DefaultPopupWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
DefaultRowHeight
Default row height for grids
Declaration
public int DefaultRowHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Dimensions
List of known Dimensions to access them in Script/Expressions
Declaration
[Browsable(false)]
public Dimensions Dimensions { get; }
Property Value
| Type | Description |
|---|---|
| Dimensions |
FieldsOrder
Declaration
public FieldComparerType FieldsOrder { get; set; }
Property Value
| Type | Description |
|---|---|
| FieldComparerType |
FilterManager
Reference to filter manager
Declaration
public FilterManager FilterManager { get; set; }
Property Value
| Type | Description |
|---|---|
| FilterManager |
FiltersContainer
Reference to Filters
Declaration
[Browsable(false)]
public FiltersContainer FiltersContainer { get; }
Property Value
| Type | Description |
|---|---|
| FiltersContainer |
HideColZeros
Gets or Sets whether to hide columns only with empty or zero cells
Declaration
public bool HideColZeros { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
HideRowZeros
Gets or Sets whether to hide rows only with empty or zero cells
Declaration
public bool HideRowZeros { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
HideTotalForSingleValue
Gets or Sets whether to hide totals for single value blocks
Declaration
public bool HideTotalForSingleValue { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Measures
List of known Measures to access them in Script/Expressions
Declaration
[Browsable(false)]
public Measures Measures { get; }
Property Value
| Type | Description |
|---|---|
| Measures |
MeasuresContainer
Reference to Measures
Declaration
[Browsable(false)]
public MeasuresContainer MeasuresContainer { get; }
Property Value
| Type | Description |
|---|---|
| MeasuresContainer |
ReferencedAssemblies
Gets or sets an array of assembly names that will be used to compile the slice script.
Declaration
[SRCategory("Script")]
public string[] ReferencedAssemblies { get; set; }
Property Value
| Type | Description |
|---|---|
| System.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.
RowCount
Gets data row count
Declaration
[Browsable(false)]
public int RowCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
ScriptLanguage
Gets or sets the script language.
Declaration
[SRCategory("Script")]
public Language ScriptLanguage { get; set; }
Property Value
| Type | Description |
|---|---|
| Language |
Remarks
Note: changing this property will reset the report script to default empty script.
ScriptRestrictions
Gets or sets a set of permissions that will be restricted for the script code.
Declaration
[Browsable(false)]
public PermissionSet ScriptRestrictions { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Security.PermissionSet |
Remarks
Since the slice 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. This property
is used to restrict such operations.
using System.Security;
using System.Security.Permissions;
...
PermissionSet ps = new PermissionSet(PermissionState.None);
ps.AddPermission(new FileIOPermission(PermissionState.Unrestricted));
slice1.ScriptRestrictions = ps;
slice1.Prepare();
ScriptText
Gets or sets the slice script.
Declaration
[Browsable(false)]
public string ScriptText { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
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. To restrict such operations, use the ScriptRestrictions property.
SelectedCol
Get active column for grid
Declaration
[Browsable(false)]
public int SelectedCol { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
SelectedRow
Get active row for grid
Declaration
[Browsable(false)]
public int SelectedRow { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
SliceFields
Collection of Slice fields
Declaration
[Browsable(false)]
public SliceFields SliceFields { get; }
Property Value
| Type | Description |
|---|---|
| SliceFields |
TopNs
Reference to TopN collection
Declaration
[Browsable(false)]
public TopNs TopNs { get; }
Property Value
| Type | Description |
|---|---|
| TopNs |
XAxisContainer
Reference to X Axis
Declaration
[Browsable(false)]
public AxisContainer XAxisContainer { get; }
Property Value
| Type | Description |
|---|---|
| AxisContainer |
YAxisContainer
Reference to Y Axis
Declaration
[Browsable(false)]
public AxisContainer YAxisContainer { get; }
Property Value
| Type | Description |
|---|---|
| AxisContainer |
Methods
BeginUpdate()
Start change operation
Declaration
public void BeginUpdate()
Calc(Expression)
Calculates an expression and returns the result.
Declaration
public object Calc(Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The expression to calculate. |
Returns
| Type | Description |
|---|---|
| System.Object | 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, Variant)
Calculates an expression and returns the result.
Declaration
public object Calc(Expression expression, Variant value)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The expression to calculate. |
| Variant | value | The value of currently building object. |
Returns
| Type | Description |
|---|---|
| System.Object | 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, Variant)
Returns an expression value.
Declaration
protected virtual object CalcExpression(Expression expression, Variant value)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The expression. |
| Variant | value | The value of currently printing object. |
Returns
| Type | Description |
|---|---|
| System.Object | 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
Declaration
public Variant CalcFuncForSelectedArea(AggregateFunction aggregateFunction, Selection selection)
Parameters
| Type | Name | Description |
|---|---|---|
| AggregateFunction | aggregateFunction | Aggregate function |
| Selection | selection | Cell selection |
Returns
| Type | Description |
|---|---|
| Variant | Calculated value |
Clear()
Clear slice. Remove all fields from containers.
Declaration
public void Clear()
ColRowToDataCellPos(Int32, Int32, ref MeasureCellBSPosition)
Converts column and row coordinates to MeasureCellBSPosition structure
Declaration
public bool ColRowToDataCellPos(int col, int row, ref MeasureCellBSPosition measureCellBSPosition)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | col | column |
| System.Int32 | row | row |
| MeasureCellBSPosition | measureCellBSPosition | reference to MeasureCellBSPosition structure |
Returns
| Type | Description |
|---|---|
| System.Boolean | False - fail, True - success |
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
Overrides
EndUpdate()
Finish change operation
Declaration
public void EndUpdate()
FindSliceFieldInContainers(SliceField, out SliceContainerType)
Searches Filters, XAxis, YAxis for a SliceField
Declaration
public int FindSliceFieldInContainers(SliceField sliceField, out SliceContainerType sliceContainerType)
Parameters
| Type | Name | Description |
|---|---|---|
| SliceField | sliceField | SliceField to find |
| SliceContainerType | sliceContainerType | Output container type where field is found or None |
Returns
| Type | Description |
|---|---|
| System.Int32 | Output field position in container or -1 |
GetChartData(ChartParams, SliceChartDataHandler)
Declaration
public void GetChartData(ChartParams chartParams, SliceChartDataHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| ChartParams | chartParams | |
| SliceChartDataHandler | handler |
GetColWidth(Int32)
Get column width (for grid)
Declaration
public int GetColWidth(int columnIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | columnIndex | column index |
Returns
| Type | Description |
|---|---|
| System.Int32 | width |
GetDetailOrderedRecordSet(Int32, Int32)
Get detail recordset for cell
Declaration
public DetailOrderedRecordSet GetDetailOrderedRecordSet(int col, int row)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | col | cell column |
| System.Int32 | row | cell row |
Returns
| Type | Description |
|---|---|
| DetailOrderedRecordSet | DetailOrderedRecordSet |
GetHierarchicalData(HierarchicalDataParams, SliceHierarchicalDataHandler)
Declaration
public void GetHierarchicalData(HierarchicalDataParams hierarchicalDataParams, SliceHierarchicalDataHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| HierarchicalDataParams | hierarchicalDataParams | |
| SliceHierarchicalDataHandler | handler |
GetMeasureCell(Int32, Int32)
Get Measure cell information by coordinates
Declaration
public MeasureCell GetMeasureCell(int col, int row)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | col | Column |
| System.Int32 | row | Row |
Returns
| Type | Description |
|---|---|
| MeasureCell | MeasureCell structure |
GetMeasureValue(Int32, Int32)
Get Measure value at position
Declaration
public Variant GetMeasureValue(int ACol, int ARow)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | ACol | column |
| System.Int32 | ARow | row |
Returns
| Type | Description |
|---|---|
| Variant | measure value |
GetMeasureValueCaption(Int32, Int32)
Get Measure text at position
Declaration
public string GetMeasureValueCaption(int ACol, int ARow)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | ACol | column |
| System.Int32 | ARow | row |
Returns
| Type | Description |
|---|---|
| System.String | measure text |
GetRowHeight(Int32)
Get row height (for grid)
Declaration
public int GetRowHeight(int rowIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | rowIndex | row index |
Returns
| Type | Description |
|---|---|
| System.Int32 | height |
InternalInit()
Initializes the slice's fields.
Declaration
protected void InternalInit()
Remarks
This method is for internal use only.
InvokeEvent(String, Object[])
Invokes the script event handler with given name.
Declaration
public void InvokeEvent(string name, object[] parms)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the script method. |
| System.Object[] | parms | The method parameters. |
IsValidDimension(String)
Checks if dimension exists in the list of known dimensions
Declaration
public bool IsValidDimension(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Dimension name |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if dimension is known |
IsValidField(String)
Checks if slice field exists in the list of known slice fields
Declaration
public bool IsValidField(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Field name |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if field is known |
IsValidMeasure(String)
Checks if measure exists in the list of known measures
Declaration
public bool IsValidMeasure(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Measure name |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if measure is known |
Load(XmlDocument)
Load from XML
Declaration
public bool Load(XmlDocument doc)
Parameters
| Type | Name | Description |
|---|---|---|
| XmlDocument | doc | XML document |
Returns
| Type | Description |
|---|---|
| System.Boolean | True - success |
Load(Stream)
Load from stream
Declaration
public bool Load(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream |
Returns
| Type | Description |
|---|---|
| System.Boolean | True - success |
Load(String)
Load from file
Declaration
public bool Load(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | File name |
Returns
| Type | Description |
|---|---|
| System.Boolean | True - success |
Save(XmlDocument, SliceSaveExtras)
Save to XML
Declaration
public void Save(XmlDocument doc, SliceSaveExtras extras = SliceSaveExtras.None)
Parameters
| Type | Name | Description |
|---|---|---|
| XmlDocument | doc | XML document |
| SliceSaveExtras | extras | Extra items to save |
Save(Stream, SliceSaveExtras)
Save to stream
Declaration
public void Save(Stream stream, SliceSaveExtras extras = SliceSaveExtras.None)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream |
| SliceSaveExtras | extras | Extra items to save |
Save(String, SliceSaveExtras)
Save to file
Declaration
public void Save(string fileName, SliceSaveExtras extras = SliceSaveExtras.None)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | File name |
| SliceSaveExtras | extras | Extra items to save |
SendAlert(SliceAlertEventArgs)
Declaration
protected void SendAlert(SliceAlertEventArgs alert)
Parameters
| Type | Name | Description |
|---|---|---|
| SliceAlertEventArgs | alert |
SetColsWidth(Int32)
Set all columns width to value (for grid)
Declaration
public void SetColsWidth(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | value | width |
SetColWidth(Int32, Int32)
Set column width (for grid)
Declaration
public void SetColWidth(int columnIndex, int value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | columnIndex | column index |
| System.Int32 | value | width |
SetRowHeight(Int32, Int32)
Set row height (for grid)
Declaration
public void SetRowHeight(int rowIndex, int value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | rowIndex | row index |
| System.Int32 | value | height |
SetRowsHeight(Int32)
Set all rows height to value (for grid)
Declaration
public void SetRowsHeight(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | value | height |
SetTotalPosition(TotalPosition)
Set total position for all levels in all axis
Declaration
public void SetTotalPosition(TotalPosition totalPosition)
Parameters
| Type | Name | Description |
|---|---|---|
| TotalPosition | totalPosition |
Transpose()
Transpose slice - change axis (X axis become Y axis and vice versa)
Declaration
public void Transpose()
Events
AlertEventHandler
Declaration
public event SliceAlertEventHandler AlertEventHandler
Event Type
| Type | Description |
|---|---|
| SliceAlertEventHandler |
OnAfterAddSliceFieldToContainer
Declaration
public event SliceFieldContainerChangedEventHandler OnAfterAddSliceFieldToContainer
Event Type
| Type | Description |
|---|---|
| SliceFieldContainerChangedEventHandler |
OnBeforeAddSliceFieldToContainer
Declaration
public event SliceFieldContainerChangeEventHandler OnBeforeAddSliceFieldToContainer
Event Type
| Type | Description |
|---|---|
| SliceFieldContainerChangeEventHandler |
OnBeforeRemoveSliceFieldFromContainer
Declaration
public event SliceFieldContainerChangeEventHandler OnBeforeRemoveSliceFieldFromContainer
Event Type
| Type | Description |
|---|---|
| SliceFieldContainerChangeEventHandler |