Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 99e9fad

Browse files
Generate PageFooter
1 parent 681576a commit 99e9fad

File tree

4 files changed

+54
-36
lines changed

4 files changed

+54
-36
lines changed

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ void CreateDataReport(ReportWizardContext context)
5555
GenerateBaseSettings(context);
5656
CreateReportHeader(context);
5757
CreatePageHeader(context);
58-
GeneratePushModel(context);
58+
CreateDetailsSection(context);
59+
CreatePageFooter (context);
5960
}
6061

6162
void GenerateBaseSettings (ReportWizardContext context) {
@@ -70,7 +71,7 @@ void GenerateBaseSettings (ReportWizardContext context) {
7071

7172

7273

73-
void GeneratePushModel(ReportWizardContext context){
74+
void CreateDetailsSection(ReportWizardContext context){
7475
var pushModelContext = (PushModelContext)context.PushModelContext;
7576
foreach (var element in pushModelContext.Items) {
7677
var dataItem = new BaseDataItem(){
@@ -130,6 +131,19 @@ void CreatePageHeader(ReportWizardContext context)
130131
ReportModel.PageHeader.Items.Add(line);
131132

132133
}
134+
//
135+
void CreatePageFooter(ReportWizardContext context)
136+
{
137+
var pageOneContext = (PageOneContext)context.PageOneContext;
138+
var lineNrField = new BaseTextItem() {
139+
Text = "='Page : ' + Globals!PageNumber + ' of ' + Globals!Pages + ' Page(s)'",
140+
Name = "LineNumber",
141+
Location = new Point(300,10),
142+
Size = new Size (GlobalValues.PreferedSize.Width * 2,GlobalValues.PreferedSize.Height)
143+
};
144+
ReportModel.PageFooter.Items.Add(lineNrField);
145+
}
146+
133147

134148
void AdjustItems (List<IPrintableObject> list,int startValue ) {
135149

src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/Ast/GlobalsNode.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ protected override object DoEvaluate(ScriptThread thread)
4747
var pi = thread.GetPageInfo();
4848

4949
var test = globalNode.AsString.ToLower();
50+
if (test.Contains(":")) {
51+
Console.WriteLine("");
52+
}
5053
if ( test == "pagenumber") {
5154
return pi.PageNumber;
5255
} else if (test == "pages") {

src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Expressions/IntegrationTests/GlobalsFixture.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ public void CanReadPageNumber()
4545
Assert.That(s.Text.Contains("Page"));
4646
}
4747

48+
[Test]
49+
public void CanEvaluateComplexStatement () {
50+
reportCreator.BuildExportList();
51+
var page = reportCreator.Pages[0];
52+
var sec = (ExportContainer)page.ExportedItems[4];
53+
var s = (ExportText)sec.ExportedItems[0];
54+
Assert.That (s.Text.Contains("1"));
55+
Assert.That(s.Text.Contains("Page"));
56+
}
4857

4958
[Test]
5059
public void CanEvaluateTotalPages () {

src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/TestReports/TestForGlobals.srd

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,24 @@
44
<ReportSettings>
55
<ReportName>Report1</ReportName>
66
<ReportType>FormSheet</ReportType>
7+
<DataModel>FormSheet</DataModel>
78
<BottomMargin>50</BottomMargin>
89
<TopMargin>50</TopMargin>
910
<LeftMargin>50</LeftMargin>
1011
<RightMargin>50</RightMargin>
1112
<PageSize>827, 1169</PageSize>
1213
<Landscape>False</Landscape>
13-
<GraphicsUnit>Millimeter</GraphicsUnit>
14-
<Padding>5, 5, 5, 5</Padding>
15-
<AvailableFieldsCollection />
14+
<ParameterCollection />
1615
<SortColumnsCollection />
1716
<GroupColumnsCollection />
18-
<ParameterCollection />
19-
<SqlParameters />
20-
<ConnectionString />
21-
<CommandText />
22-
<CommandType>Text</CommandType>
23-
<DataModel>FormSheet</DataModel>
24-
<NoDataMessage>No Data for this Report</NoDataMessage>
25-
<DefaultFont>Microsoft Sans Serif, 10pt</DefaultFont>
26-
<UseStandardPrinter>True</UseStandardPrinter>
2717
</ReportSettings>
2818
</ReportSettings>
2919
<SectionCollection>
3020
<BaseSection>
3121
<Location>50, 50</Location>
3222
<Size>727, 60</Size>
3323
<BackColor>White</BackColor>
34-
<SectionOffset>0</SectionOffset>
35-
<SectionMargin>0</SectionMargin>
3624
<DrawBorder>False</DrawBorder>
37-
<PageBreakAfter>False</PageBreakAfter>
3825
<Items>
3926
<BaseTextItem>
4027
<Location>383, 17</Location>
@@ -43,9 +30,9 @@
4330
<Font>Segoe UI, 9pt</Font>
4431
<StringTrimming>None</StringTrimming>
4532
<ContentAlignment>TopLeft</ContentAlignment>
33+
<TextAlignment>Left</TextAlignment>
4634
<CanGrow>False</CanGrow>
4735
<CanShrink>False</CanShrink>
48-
<RTL>No</RTL>
4936
<Text>= 'ReportFileName : ' + Globals!reportfilename</Text>
5037
<DrawBorder>False</DrawBorder>
5138
<FrameColor>Black</FrameColor>
@@ -59,10 +46,10 @@
5946
<Font>Microsoft Sans Serif, 10pt</Font>
6047
<StringTrimming>None</StringTrimming>
6148
<ContentAlignment>TopLeft</ContentAlignment>
49+
<TextAlignment>Left</TextAlignment>
6250
<CanGrow>False</CanGrow>
6351
<CanShrink>False</CanShrink>
6452
<DataType>System.String</DataType>
65-
<RTL>No</RTL>
6653
<Text>= 'ReportFolder :' + Globals!ReportFolder</Text>
6754
<DrawBorder>False</DrawBorder>
6855
<FrameColor>Black</FrameColor>
@@ -77,10 +64,7 @@
7764
<Location>50, 125</Location>
7865
<Size>727, 60</Size>
7966
<BackColor>White</BackColor>
80-
<SectionOffset>0</SectionOffset>
81-
<SectionMargin>0</SectionMargin>
8267
<DrawBorder>False</DrawBorder>
83-
<PageBreakAfter>False</PageBreakAfter>
8468
<Items>
8569
<BaseTextItem>
8670
<Location>16, 4</Location>
@@ -89,9 +73,9 @@
8973
<Font>Segoe UI, 9pt</Font>
9074
<StringTrimming>None</StringTrimming>
9175
<ContentAlignment>TopLeft</ContentAlignment>
76+
<TextAlignment>Left</TextAlignment>
9277
<CanGrow>False</CanGrow>
9378
<CanShrink>False</CanShrink>
94-
<RTL>No</RTL>
9579
<Text>='Pages ' + Globals!Pages</Text>
9680
<DrawBorder>False</DrawBorder>
9781
<FrameColor>Black</FrameColor>
@@ -106,10 +90,7 @@
10690
<Location>50, 200</Location>
10791
<Size>727, 60</Size>
10892
<BackColor>White</BackColor>
109-
<SectionOffset>0</SectionOffset>
110-
<SectionMargin>0</SectionMargin>
11193
<DrawBorder>False</DrawBorder>
112-
<PageBreakAfter>False</PageBreakAfter>
11394
<Items>
11495
<BaseTextItem>
11596
<Location>16, 4</Location>
@@ -118,9 +99,9 @@
11899
<Font>Segoe UI, 9pt</Font>
119100
<StringTrimming>None</StringTrimming>
120101
<ContentAlignment>TopLeft</ContentAlignment>
102+
<TextAlignment>Left</TextAlignment>
121103
<CanGrow>False</CanGrow>
122104
<CanShrink>False</CanShrink>
123-
<RTL>No</RTL>
124105
<Text>= 'ReportName : ' + Globals!ReportName</Text>
125106
<DrawBorder>False</DrawBorder>
126107
<FrameColor>Black</FrameColor>
@@ -135,10 +116,7 @@
135116
<Location>50, 275</Location>
136117
<Size>727, 60</Size>
137118
<BackColor>White</BackColor>
138-
<SectionOffset>0</SectionOffset>
139-
<SectionMargin>0</SectionMargin>
140119
<DrawBorder>False</DrawBorder>
141-
<PageBreakAfter>False</PageBreakAfter>
142120
<Items>
143121
<BaseTextItem>
144122
<Location>16, 4</Location>
@@ -147,9 +125,9 @@
147125
<Font>Segoe UI, 9pt</Font>
148126
<StringTrimming>None</StringTrimming>
149127
<ContentAlignment>TopLeft</ContentAlignment>
128+
<TextAlignment>Left</TextAlignment>
150129
<CanGrow>False</CanGrow>
151130
<CanShrink>False</CanShrink>
152-
<RTL>No</RTL>
153131
<Text>=Globals!SyntaxError</Text>
154132
<DrawBorder>False</DrawBorder>
155133
<FrameColor>Black</FrameColor>
@@ -163,10 +141,10 @@
163141
<Font>Microsoft Sans Serif, 10pt</Font>
164142
<StringTrimming>None</StringTrimming>
165143
<ContentAlignment>TopLeft</ContentAlignment>
144+
<TextAlignment>Left</TextAlignment>
166145
<CanGrow>False</CanGrow>
167146
<CanShrink>False</CanShrink>
168147
<DataType>System.String</DataType>
169-
<RTL>No</RTL>
170148
<Text>='Page ' + Globals!PageNumber</Text>
171149
<DrawBorder>False</DrawBorder>
172150
<FrameColor>Black</FrameColor>
@@ -181,11 +159,25 @@
181159
<Location>50, 350</Location>
182160
<Size>727, 60</Size>
183161
<BackColor>White</BackColor>
184-
<SectionOffset>0</SectionOffset>
185-
<SectionMargin>0</SectionMargin>
186162
<DrawBorder>False</DrawBorder>
187-
<PageBreakAfter>False</PageBreakAfter>
188-
<Items />
163+
<Items>
164+
<BaseTextItem>
165+
<Location>16, 16</Location>
166+
<Size>393, 20</Size>
167+
<BackColor>White</BackColor>
168+
<Font>Segoe UI, 9pt</Font>
169+
<StringTrimming>None</StringTrimming>
170+
<ContentAlignment>TopLeft</ContentAlignment>
171+
<TextAlignment>Left</TextAlignment>
172+
<CanGrow>False</CanGrow>
173+
<CanShrink>False</CanShrink>
174+
<Text>='Page : ' + Globals!PageNumber + 'Pages :' + Globals!Pages</Text>
175+
<DrawBorder>False</DrawBorder>
176+
<FrameColor>Black</FrameColor>
177+
<ForeColor>ControlText</ForeColor>
178+
<Name>BaseTextItem2147483646</Name>
179+
</BaseTextItem>
180+
</Items>
189181
<FrameColor>Black</FrameColor>
190182
<Name>ReportFooter</Name>
191183
</BaseSection>

0 commit comments

Comments
 (0)