Skip to content

Commit a320b5e

Browse files
authored
Merge pull request #36 from techyian/0.2.1
0.2.1 - DateAndTime parsers
2 parents b4e20de + 0b36dc2 commit a320b5e

File tree

87 files changed

+5678
-315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+5678
-315
lines changed

ReportViewer.NET.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReportViewer.NET", "src\Rep
77
EndProject
88
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReportViewer.NET.Web", "src\ReportViewer.NET.Web\ReportViewer.NET.Web.csproj", "{15439CA2-723D-42AB-99FE-5A89588A3799}"
99
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReportViewer.NET.Tests", "test\ReportViewer.NET.Tests\ReportViewer.NET.Tests.csproj", "{C9C8777C-079E-4804-8EF0-4DFE2EF5597E}"
11+
EndProject
1012
Global
1113
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1214
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
2123
{15439CA2-723D-42AB-99FE-5A89588A3799}.Debug|Any CPU.Build.0 = Debug|Any CPU
2224
{15439CA2-723D-42AB-99FE-5A89588A3799}.Release|Any CPU.ActiveCfg = Release|Any CPU
2325
{15439CA2-723D-42AB-99FE-5A89588A3799}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{C9C8777C-079E-4804-8EF0-4DFE2EF5597E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{C9C8777C-079E-4804-8EF0-4DFE2EF5597E}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{C9C8777C-079E-4804-8EF0-4DFE2EF5597E}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{C9C8777C-079E-4804-8EF0-4DFE2EF5597E}.Release|Any CPU.Build.0 = Release|Any CPU
2430
EndGlobalSection
2531
GlobalSection(SolutionProperties) = preSolution
2632
HideSolutionNode = FALSE

assets/reportviewer.net.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@
5858
}
5959

6060
.report-row p {
61+
margin-top: 0;
6162
margin-bottom: 0;
6263
}
6364

6465
.report-row {
6566
display: flex;
6667
flex-direction: row;
6768
width: 100%;
68-
margin-bottom: 0.75rem;
69+
margin-bottom: 0.25rem;
6970
overflow-x: auto;
7071
}
7172

@@ -99,6 +100,10 @@
99100
flex-wrap: wrap;
100101
}
101102

103+
.reportviewer-line {
104+
position: absolute;
105+
}
106+
102107
.reportviewer-table-pager {
103108
margin-bottom: 1rem;
104109
}

readme.md

Lines changed: 74 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ All reports available at the following GitHub link are tested against ReportView
110110

111111
Additional reports are available in the `/test/reports/` directory of this repository and have been based off official Microsoft tutorials available here: https://learn.microsoft.com/en-us/sql/reporting-services/reporting-services-tutorials-ssrs?view=sql-server-ver16, and here: https://learn.microsoft.com/en-us/sql/reporting-services/report-builder-tutorials?view=sql-server-ver16.
112112

113+
## Help/FAQ
114+
115+
1. Q: When I have a tall element which spans multiple rows in my report, stacked members sharing the same row(s) aren't positioned correctly.
116+
117+
A: Due to the way ReportViewer.NET calculates the position of elements, if you have a tall element which spans many rows, stacked members on the same row will not display as you may expect. Try wrapping stacked elements in a Rectangle. You will need to explicitly paste your elements into the Rectangle for this to work.
113118

114119
## Screenshots
115120

@@ -166,7 +171,7 @@ https://github.com/Apress/beg-sql-server-reporting-services/blob/master/Beginnin
166171
| Tablix | Complete? | Groups, sorting, TablixRowHierarchy, TablixColumnHierarchy appear working. Standard/matrix tables look pretty accurate from local testing. |
167172
| Rectangle | Complete | |
168173
| Line | Complete | |
169-
| Image | Partial | JPEG/PNG currently supported. TODO: Background images, external images. |
174+
| Image | Partial | TODO: Background images, external images. |
170175
| Sub Report | Complete | |
171176
| Chart | Not started| |
172177
| Gauge | Not started| |
@@ -182,15 +187,15 @@ https://github.com/Apress/beg-sql-server-reporting-services/blob/master/Beginnin
182187
| Field | Status | Comments |
183188
| ------- | ------ | -------- |
184189
| ExecutionTime | Complete | |
185-
| Language | Not started | |
190+
| Language | Complete | |
186191
| OverallPageNumber | Not started | |
187192
| OverallTotalPages | Not started | |
188193
| PageName | Not started | |
189194
| PageNumber | Not started | |
190195
| RenderFormat.IsInteractive | Not started | |
191196
| RenderFormat.Name | Not started | |
192197
| ReportFolder | Not started | |
193-
| ReportName | Not started | |
198+
| ReportName | Complete | |
194199
| ReportServerUrl | Not started | |
195200
| TotalPages | Not started | |
196201
| UserID | Not started | |
@@ -232,6 +237,10 @@ https://github.com/Apress/beg-sql-server-reporting-services/blob/master/Beginnin
232237
| ----- | ------- | ------ | -------- |
233238
| | Fields | Complete | |
234239
| | Parameters | Complete | |
240+
241+
### Text
242+
| Group | Expression | Status | Comments |
243+
| ----- | ------- | ------ | -------- |
235244
| Text | Asc | Not started | |
236245
| Text | AscW | Not started | |
237246
| Text | Asc | Not started | |
@@ -265,30 +274,40 @@ https://github.com/Apress/beg-sql-server-reporting-services/blob/master/Beginnin
265274
| Text | StrRev | Not started | |
266275
| Text | Trim | Not started | |
267276
| Text | UCase | Not started | |
268-
| Date & Time | CDate | Not started | |
269-
| Date & Time | DateAdd | Not started | |
270-
| Date & Time | DateDiff | Not started | |
271-
| Date & Time | DatePart | Not started | |
272-
| Date & Time | DateSerial | Not started | |
273-
| Date & Time | DateString | Not started | |
274-
| Date & Time | DateValue | Not started | |
275-
| Date & Time | Day | Not started | |
276-
| Date & Time | FormatDateTime | Not started | |
277-
| Date & Time | Hour | Not started | |
278-
| Date & Time | Minute | Not started | |
279-
| Date & Time | Month | Not started | |
277+
278+
### Date & Time
279+
280+
| Group | Expression | Status | Comments |
281+
| ----- | ------- | ------ | -------- |
282+
| Date & Time | CDate | Complete | |
283+
| Date & Time | DateAdd | Complete | |
284+
| Date & Time | DateDiff | Complete | |
285+
| Date & Time | DatePart | Partial | Not yet tested with all time intervals |
286+
| Date & Time | DateSerial | Complete | |
287+
| Date & Time | DateString | Complete | |
288+
| Date & Time | DateValue | Complete | |
289+
| Date & Time | Day | Complete | |
290+
| Date & Time | FormatDateTime | Complete | |
291+
| Date & Time | Hour | Complete | |
292+
| Date & Time | Minute | Complete | |
293+
| Date & Time | Month | Complete | |
280294
| Date & Time | MonthName | Complete | |
281-
| Date & Time | Now | Not started | |
282-
| Date & Time | Second | Not started | |
283-
| Date & Time | TimeOfDay | Not started | |
284-
| Date & Time | Timer | Not started | |
285-
| Date & Time | TimeSerial | Not started | |
286-
| Date & Time | TimeString | Not started | |
287-
| Date & Time | TimeValue | Not started | |
288-
| Date & Time | Today | Not started | |
289-
| Date & Time | Weekday | Not started | |
290-
| Date & Time | WeekdayName | Not started | |
291-
| Date & Time | Year | Not started | |
295+
| Date & Time | Now | Complete | |
296+
| Date & Time | Second | Complete | |
297+
| Date & Time | TimeOfDay | Complete | |
298+
| Date & Time | Timer | Complete | |
299+
| Date & Time | TimeSerial | Complete | |
300+
| Date & Time | TimeString | Complete | |
301+
| Date & Time | TimeValue | Complete | |
302+
| Date & Time | Today | Complete | |
303+
| Date & Time | Weekday | Complete | |
304+
| Date & Time | WeekdayName | Complete | |
305+
| Date & Time | Year | Complete | |
306+
307+
### Math
308+
309+
| Group | Expression | Status | Comments |
310+
| ----- | ------- | ------ | -------- |
292311
| Math | Abs | Not started | |
293312
| Math | Acos | Not started | |
294313
| Math | Asin | Not started | |
@@ -315,13 +334,28 @@ https://github.com/Apress/beg-sql-server-reporting-services/blob/master/Beginnin
315334
| Math | Sqrt | Not started | |
316335
| Math | Tan | Not started | |
317336
| Math | Tanh | Not started | |
337+
338+
### Inspection
339+
340+
| Group | Expression | Status | Comments |
341+
| ----- | ------- | ------ | -------- |
318342
| Inspection | IsArray | Not started | |
319343
| Inspection | IsDate | Not started | |
320344
| Inspection | IsNothing | Complete | |
321345
| Inspection | IsNumeric | Not started | |
346+
347+
### Program Flow
348+
349+
| Group | Expression | Status | Comments |
350+
| ----- | ------- | ------ | -------- |
322351
| Program Flow | Choose | Not started | |
323352
| Program Flow | IIf | Complete | |
324353
| Program Flow | Switch | Not started | |
354+
355+
### Aggregate
356+
357+
| Group | Expression | Status | Comments |
358+
| ----- | ------- | ------ | -------- |
325359
| Aggregate | Avg | Not started | |
326360
| Aggregate | Count | Partial | TODO: Handle other count expressions not using fields?? |
327361
| Aggregate | CountDistinct | Partial | As above |
@@ -338,6 +372,10 @@ https://github.com/Apress/beg-sql-server-reporting-services/blob/master/Beginnin
338372
| Aggregate | VarP | Not started | |
339373
| Aggregate | RunningValue | Not started | |
340374
| Aggregate | Aggregate | Not started | |
375+
376+
### Financial
377+
| Group | Expression | Status | Comments |
378+
| ----- | ------- | ------ | -------- |
341379
| Financial | DDB | Not started | |
342380
| Financial | FV | Not started | |
343381
| Financial | IPmt | Not started | |
@@ -348,6 +386,11 @@ https://github.com/Apress/beg-sql-server-reporting-services/blob/master/Beginnin
348386
| Financial | Rate | Not started | |
349387
| Financial | SLN | Not started | |
350388
| Financial | SYD | Not started | |
389+
390+
### Conversion
391+
392+
| Group | Expression | Status | Comments |
393+
| ----- | ------- | ------ | -------- |
351394
| Conversion | CBool | Not started | |
352395
| Conversion | CByte | Not started | |
353396
| Conversion | CChar | Not started | |
@@ -367,6 +410,11 @@ https://github.com/Apress/beg-sql-server-reporting-services/blob/master/Beginnin
367410
| Conversion | Oct | Not started | |
368411
| Conversion | Str | Not started | |
369412
| Conversion | Val | Not started | |
413+
414+
### Misc
415+
416+
| Group | Expression | Status | Comments |
417+
| ----- | ------- | ------ | -------- |
370418
| Misc | InScope | Not started | |
371419
| Misc | Level | Not started | |
372420
| Misc | Lookup | Not started | |

src/ReportViewer.NET.Web/wwwroot/css/site.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@
5858
}
5959

6060
.report-row p {
61+
margin-top: 0;
6162
margin-bottom: 0;
6263
}
6364

6465
.report-row {
6566
display: flex;
6667
flex-direction: row;
6768
width: 100%;
68-
margin-bottom: 0.75rem;
69+
margin-bottom: 0.25rem;
6970
overflow-x: auto;
7071
}
7172

@@ -99,6 +100,10 @@
99100
flex-wrap: wrap;
100101
}
101102

103+
.reportviewer-line {
104+
position: absolute;
105+
}
106+
102107
.reportviewer-table-pager {
103108
margin-bottom: 1rem;
104109
}

src/ReportViewer.NET/Comparers/ReportItemComparer.cs

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,57 @@ public class ReportItemComparer : IComparer<ReportItem>
77
{
88
public int Compare(ReportItem x, ReportItem y)
99
{
10-
if (x?.Top == 0 || y?.Top == 0)
11-
{
12-
return -1;
13-
}
10+
//if (x.Top == 0 || y.Top == 0)
11+
//{
12+
// return -1;
13+
//}
1414

15-
if (x?.Top == y?.Top && x?.Left < y?.Left)
15+
if (x.Top == y.Top && x.Left < y.Left)
1616
{
1717
return -1;
1818
}
1919

20-
if (x?.Top == y?.Top && x?.Left > y?.Left)
20+
if (x.Top == y.Top && x.Left > y.Left)
2121
{
2222
return 1;
2323
}
2424

25-
if (x?.Top == y?.Top)
25+
if (x.Top == y.Top)
2626
{
2727
return 0;
2828
}
2929

30-
if (x?.Top > y?.Top)
30+
if (x is Tablix && y is Line && x.Top < y.Top)
31+
{
32+
y.Style.Position = "";
33+
}
34+
35+
if (y is Tablix && x is Line && y.Top < x.Top)
3136
{
32-
if (x?.Top > y?.Top + y?.Height)
37+
x.Style.Position = "";
38+
}
39+
40+
if (x.Top > y.Top)
41+
{
42+
if (x is Line && x.Style.Position == "absolute")
3343
{
44+
// x top is higher, line is absolute so don't consider height.
45+
return 1;
46+
}
47+
48+
if (x.Top > y.Top + y.Height && (!(y is Line) || (y is Line && y.Style.Position == "")))
49+
{
3450
// New row.
3551
return 1;
3652
}
53+
else if (x.Top > y.Top && y is Line && y.Style.Position == "absolute")
54+
{
55+
return 1;
56+
}
3757
else
3858
{
3959
// Same row.
40-
if (x?.Left > y?.Left)
60+
if (x.Left > y.Left)
4161
{
4262
return 1;
4363
}
@@ -47,14 +67,24 @@ public int Compare(ReportItem x, ReportItem y)
4767
}
4868
else
4969
{
50-
if (y?.Top > x?.Top + x?.Height)
70+
if (x is Line && x.Style.Position == "absolute")
71+
{
72+
// x top is lower, line is absolute so don't consider height.
73+
return -1;
74+
}
75+
76+
if (y.Top > x.Top + x.Height && (!(x is Line) || (x is Line && x.Style.Position == "")))
77+
{
78+
return -1;
79+
}
80+
else if (y.Top > x.Top && x is Line && x.Style.Position == "absolute")
5181
{
5282
return -1;
5383
}
5484
else
5585
{
5686
// Same row.
57-
if (y?.Left > x?.Left)
87+
if (y.Left > x.Left)
5888
{
5989
return -1;
6090
}

src/ReportViewer.NET/DataObjects/ReportItems/Image.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,15 @@ public override string Build(ReportItem parent)
5656
private string BuildEmbeddedImage()
5757
{
5858
switch (this.EmbeddedImage.MimeType)
59-
{
60-
// TODO: Handle other mime types.
59+
{
6160
case "image/jpeg":
6261
return $"<img class=\"reportviewer-image img\" {Style?.Build()} data-toggle=\"{this.ToggleItem}\" src=\"data:image/jpeg;base64, {this.EmbeddedImage.ImageData}\" />";
6362
case "image/png":
64-
return $"<img class=\"reportviewer-image img\" {Style?.Build()} data-toggle=\"{this.ToggleItem}\" src=\"data:image/png;base64, {this.EmbeddedImage.ImageData}\" />";
63+
return $"<img class=\"reportviewer-image img\" {Style?.Build()} data-toggle=\"{this.ToggleItem}\" src=\"data:image/png;base64, {this.EmbeddedImage.ImageData}\" />";
64+
case "image/bmp":
65+
return $"<img class=\"reportviewer-image img\" {Style?.Build()} data-toggle=\"{this.ToggleItem}\" src=\"data:image/bmp;base64, {this.EmbeddedImage.ImageData}\" />";
66+
case "image/gif":
67+
return $"<img class=\"reportviewer-image img\" {Style?.Build()} data-toggle=\"{this.ToggleItem}\" src=\"data:image/gif;base64, {this.EmbeddedImage.ImageData}\" />";
6568
}
6669

6770
return string.Empty;
@@ -70,7 +73,7 @@ private string BuildEmbeddedImage()
7073
private string BuildDatabaseImage(ReportItem parent)
7174
{
7275
var dataSetResults = this.GroupedResults?.Select(r => r).ToList() ?? this.DataSetReference?.DataSet?.DataSetResults;
73-
var parsedValue = this.Report.Parser.ParseTablixExpressionString(this.Value, dataSetResults, this.Values, this.CurrentRowNumber, this.DataSets, this.DataSetReference?.DataSet, null);
76+
var parsedValue = this.Report.Parser.ParseReportExpressionString(this.Value, dataSetResults, this.Values, this.CurrentRowNumber, this.DataSets, this.DataSetReference?.DataSet, null);
7477
var b64 = string.Empty;
7578

7679
// TODO: Will this ever not be a byte[]?

0 commit comments

Comments
 (0)