Repository navigation
Expand file tree
/
Copy pathSystemVariables.cs
More file actions
286 lines (257 loc) · 6.43 KB
/
Copy pathSystemVariables.cs
File metadata and controls
286 lines (257 loc) · 6.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace FastReport.Data
{
/// <summary>
/// Represents the collection of system variables.
/// </summary>
public class SystemVariables : ParameterCollection
{
internal SystemVariables(Base owner) : base(owner)
{
Add(new DateVariable());
Add(new PageVariable());
Add(new TotalPagesVariable());
Add(new PageNVariable());
Add(new PageNofMVariable());
Add(new RowVariable());
Add(new AbsRowVariable());
Add(new PageMacroVariable());
Add(new TotalPagesMacroVariable());
Add(new CopyNameMacroVariable());
Add(new HierarchyLevelVariable());
Add(new HierarchyRowNoVariable());
}
}
/// <summary>
/// Represents the base class for system variables.
/// </summary>
public class SystemVariable : Parameter
{
/// <summary>
/// This property is not relevant to this class.
/// </summary>
[Browsable(false)]
public new string Expression
{
get { return base.Expression; }
set { base.Expression = value; }
}
/// <summary>
/// This property is not relevant to this class.
/// </summary>
[Browsable(false)]
public new string Description
{
get { return base.Description; }
set { base.Description = value; }
}
/// <inheritdoc/>
public override bool CanContain(Base child)
{
return false;
}
}
/// <summary>
/// Returns date and time of the report's start.
/// </summary>
public class DateVariable : SystemVariable
{
/// <inheritdoc/>
public override object Value
{
get { return Report.Engine.Date; }
}
internal DateVariable()
{
Name = "Date";
DataType = typeof(DateTime);
}
}
/// <summary>
/// Returns current page number.
/// </summary>
public class PageVariable : SystemVariable
{
/// <inheritdoc/>
public override object Value
{
get { return Report.Engine.PageNo; }
}
internal PageVariable()
{
Name = "Page";
DataType = typeof(int);
}
}
/// <summary>
/// Returns total number of pages in the report. To use this variable, you need
/// to enable the report's double pass.
/// </summary>
public class TotalPagesVariable : SystemVariable
{
/// <inheritdoc/>
public override object Value
{
get { return Report.Engine.TotalPages; }
}
internal TotalPagesVariable()
{
Name = "TotalPages";
DataType = typeof(int);
}
}
/// <summary>
/// Returns a string containing the current page number in a form "Page N".
/// </summary>
public class PageNVariable : SystemVariable
{
/// <inheritdoc/>
public override object Value
{
get { return Report.Engine.PageN; }
}
internal PageNVariable()
{
Name = "PageN";
DataType = typeof(string);
}
}
/// <summary>
/// Returns a string containing the current page number and total pages in a form "Page N of M".
/// To use this variable, you need to enable the report's double pass.
/// </summary>
public class PageNofMVariable : SystemVariable
{
/// <inheritdoc/>
public override object Value
{
get { return Report.Engine.PageNofM; }
}
internal PageNofMVariable()
{
Name = "PageNofM";
DataType = typeof(string);
}
}
/// <summary>
/// Returns data row number inside the group. This value is reset at the start of a new group.
/// </summary>
public class RowVariable : SystemVariable
{
/// <inheritdoc/>
public override object Value
{
get { return Report.Engine.RowNo; }
}
internal RowVariable()
{
Name = "Row#";
DataType = typeof(int);
}
}
/// <summary>
/// Returns absolute number of data row. This value is never reset at the start of a new group.
/// </summary>
public class AbsRowVariable : SystemVariable
{
/// <inheritdoc/>
public override object Value
{
get { return Report.Engine.AbsRowNo; }
}
internal AbsRowVariable()
{
Name = "AbsRow#";
DataType = typeof(int);
}
}
/// <summary>
/// Returns current page number.
/// <para/>This variable is actually a macro. Its value is substituted when the component is viewed in
/// the preview window. That means you cannot use it in an expression.
/// </summary>
public class PageMacroVariable : SystemVariable
{
/// <inheritdoc/>
public override object Value
{
get { return "[PAGE#]"; }
}
internal PageMacroVariable()
{
Name = "Page#";
DataType = typeof(int);
}
}
/// <summary>
/// Returns the number of total pages in the report.
/// <para/>This variable is actually a macro. Its value is substituted when the component is viewed in
/// the preview window. That means you cannot use it in an expression.
/// </summary>
public class TotalPagesMacroVariable : SystemVariable
{
/// <inheritdoc/>
public override object Value
{
get { return "[TOTALPAGES#]"; }
}
internal TotalPagesMacroVariable()
{
Name = "TotalPages#";
DataType = typeof(int);
}
}
/// <summary>
/// Returns the name of the printed copy.
/// <para/>This variable is actually a macro. Its value is substituted when the component is viewed in
/// the preview window. That means you cannot use it in an expression.
/// </summary>
public class CopyNameMacroVariable : SystemVariable
{
/// <inheritdoc/>
public override object Value
{
get { return "[COPYNAME#]"; }
}
internal CopyNameMacroVariable()
{
Name = "CopyName#";
DataType = typeof(string);
}
}
/// <summary>
/// Returns a level of hierarchy in the hierarchical report.
/// </summary>
public class HierarchyLevelVariable : SystemVariable
{
/// <inheritdoc/>
public override object Value
{
get { return Report.Engine.HierarchyLevel; }
}
internal HierarchyLevelVariable()
{
Name = "HierarchyLevel";
DataType = typeof(int);
}
}
/// <summary>
/// Returns the row number like "1.2.1" in the hierarchical report.
/// </summary>
public class HierarchyRowNoVariable : SystemVariable
{
/// <inheritdoc/>
public override object Value
{
get { return Report.Engine.HierarchyRowNo; }
}
internal HierarchyRowNoVariable()
{
Name = "HierarchyRow#";
DataType = typeof(string);
}
}
}