Table rewritten, Cell, TopBorder, LeftBorder, BottomMerge, RightMerge added, merging OK, clean-up, ver. 3.8.2108
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,8 +7,6 @@ using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using Results;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Output.Printers.Zapiska
|
||||
@@ -60,15 +58,15 @@ namespace Results.Output.Printers.Zapiska
|
||||
///
|
||||
/// Items to print
|
||||
///
|
||||
string header;
|
||||
IList<WMeterRsltItemSpec> commonItems1;
|
||||
IList<WMeterRsltItemSpec> commonItems2;
|
||||
IList<WMeterRsltItemSpec> commonItems3;
|
||||
IList<WMeterRsltItemSpec> selectedItems;
|
||||
IList<WMeterRsltItemSpec> belowItems1;
|
||||
IList<WMeterRsltItemSpec> belowItems2;
|
||||
IList<WMeterRsltItemSpec> belowItems3;
|
||||
string footer;
|
||||
readonly string header;
|
||||
readonly IList<WMeterRsltItemSpec> commonItems1;
|
||||
readonly IList<WMeterRsltItemSpec> commonItems2;
|
||||
readonly IList<WMeterRsltItemSpec> commonItems3;
|
||||
readonly IList<WMeterRsltItemSpec> selectedItems;
|
||||
readonly IList<WMeterRsltItemSpec> belowItems1;
|
||||
readonly IList<WMeterRsltItemSpec> belowItems2;
|
||||
readonly IList<WMeterRsltItemSpec> belowItems3;
|
||||
readonly string footer;
|
||||
|
||||
///
|
||||
/// Layout and status
|
||||
@@ -94,20 +92,20 @@ namespace Results.Output.Printers.Zapiska
|
||||
leftMargin = cfg.LeftMargin;
|
||||
|
||||
header = string.IsNullOrEmpty(cfg.Header) ? string.Empty : cfg.Header.Replace("~", Environment.NewLine);
|
||||
commonItems1 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems1);
|
||||
commonItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems2);
|
||||
commonItems3 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems3);
|
||||
selectedItems = Results.WMeterRsltItemSpec.FromStrArray(cfg.SelectedItems);
|
||||
belowItems1 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems1);
|
||||
belowItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems2);
|
||||
belowItems3 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems3);
|
||||
commonItems1 = WMeterRsltItemSpec.FromStrArray(cfg.CommonItems1);
|
||||
commonItems2 = WMeterRsltItemSpec.FromStrArray(cfg.CommonItems2);
|
||||
commonItems3 = WMeterRsltItemSpec.FromStrArray(cfg.CommonItems3);
|
||||
selectedItems = WMeterRsltItemSpec.FromStrArray(cfg.SelectedItems);
|
||||
belowItems1 = WMeterRsltItemSpec.FromStrArray(cfg.BelowItems1);
|
||||
belowItems2 = WMeterRsltItemSpec.FromStrArray(cfg.BelowItems2);
|
||||
belowItems3 = WMeterRsltItemSpec.FromStrArray(cfg.BelowItems3);
|
||||
footer = string.IsNullOrEmpty(cfg.Footer) ? string.Empty : cfg.Footer.Replace("~", Environment.NewLine);
|
||||
|
||||
/// Initialize fonts
|
||||
titleFont = new Font((cfg.TitFntFml != null ? cfg.TitFntFml : "Arial"), (cfg.TitFntSz > 0 ? cfg.TitFntSz : 10), (FontStyle)cfg.TitFntSty);
|
||||
headerFont = new Font((cfg.HdrFntFml != null ? cfg.HdrFntFml : "Arial"), (cfg.HdrFntSz > 0 ? cfg.HdrFntSz : 10), (FontStyle)cfg.HdrFntSty);
|
||||
font = new Font((cfg.BodyFntFml != null ? cfg.BodyFntFml : "Arial"), (cfg.BodyFntSz > 0 ? cfg.BodyFntSz : 10), (FontStyle)cfg.BodyFntSty);
|
||||
footerFont = new Font((cfg.FooterFntFml != null ? cfg.FooterFntFml : "Arial"), (cfg.FooterFntSz > 0 ? cfg.FooterFntSz : 10), (FontStyle)cfg.FooterFntSty);
|
||||
titleFont = new Font(cfg.TitFntFml ?? "Arial", cfg.TitFntSz > 0 ? cfg.TitFntSz : 10, (FontStyle)cfg.TitFntSty);
|
||||
headerFont = new Font(cfg.HdrFntFml ?? "Arial", cfg.HdrFntSz > 0 ? cfg.HdrFntSz : 10, (FontStyle)cfg.HdrFntSty);
|
||||
font = new Font(cfg.BodyFntFml ?? "Arial", cfg.BodyFntSz > 0 ? cfg.BodyFntSz : 10, (FontStyle)cfg.BodyFntSty);
|
||||
footerFont = new Font(cfg.FooterFntFml ?? "Arial", cfg.FooterFntSz > 0 ? cfg.FooterFntSz : 10, (FontStyle)cfg.FooterFntSty);
|
||||
|
||||
/// Set print area size and margins (in dots using 100 dpi)
|
||||
DefaultPageSettings.Landscape = (cfg.PageOrientation == PageOrientation.Landscape);
|
||||
@@ -142,7 +140,7 @@ namespace Results.Output.Printers.Zapiska
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks></remarks>
|
||||
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
|
||||
protected override void OnBeginPrint(PrintEventArgs e)
|
||||
{
|
||||
base.OnBeginPrint(e);
|
||||
}
|
||||
@@ -152,7 +150,7 @@ namespace Results.Output.Printers.Zapiska
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks>This provides the print logic for our document</remarks>
|
||||
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
protected override void OnPrintPage(PrintPageEventArgs e)
|
||||
{
|
||||
/// Run base code
|
||||
base.OnPrintPage(e);
|
||||
@@ -344,8 +342,7 @@ namespace Results.Output.Printers.Zapiska
|
||||
/// <param name="printedWMNr">Number of the water meter printed</param>
|
||||
/// <param name="top">Top coordinate of watermeter data</param>
|
||||
/// <returns>The height of the printed section</returns>
|
||||
float PrintWMs(System.Drawing.Printing.PrintPageEventArgs e,
|
||||
IList<Results.Entities.WaterMeter> wms, float top)
|
||||
float PrintWMs(PrintPageEventArgs e, IList<Results.Entities.WaterMeter> wms, float top)
|
||||
{
|
||||
///
|
||||
/// Prepare table content
|
||||
@@ -384,7 +381,7 @@ namespace Results.Output.Printers.Zapiska
|
||||
}
|
||||
|
||||
|
||||
float DrawTable(System.Drawing.Printing.PrintPageEventArgs e, float left, float top, string[] header, IList<string[]> rows, Alignment[] alignment)
|
||||
float DrawTable(PrintPageEventArgs e, float left, float top, string[] header, IList<string[]> rows, Alignment[] alignment)
|
||||
{
|
||||
int tblColumnsCount = header.Length;
|
||||
|
||||
@@ -462,7 +459,7 @@ namespace Results.Output.Printers.Zapiska
|
||||
static Font lastFont = null;
|
||||
static float lastSpacing = 0;
|
||||
|
||||
SizeF Measure(System.Drawing.Printing.PrintPageEventArgs e, string paragraph, Font font)
|
||||
SizeF Measure(PrintPageEventArgs e, string paragraph, Font font)
|
||||
{
|
||||
if (font != lastFont)
|
||||
{
|
||||
@@ -482,7 +479,7 @@ namespace Results.Output.Printers.Zapiska
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, float x, float y, float width, string paragraph, Font font, Alignment alignment)
|
||||
void PrintAt(PrintPageEventArgs e, float x, float y, float width, string paragraph, Font font, Alignment alignment)
|
||||
{
|
||||
SizeF size = Measure(e, paragraph, font);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user