using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Text.RegularExpressions; using System.Windows.Forms; using System.Drawing; using System.Data; using FastReport; using FastReport.Data; using FastReport.Dialog; using FastReport.Barcode; using FastReport.Table; using FastReport.Utils; namespace FastReport { public class ReportScript { private void Cover_StartPage(object sender, EventArgs e) { DataSourceBase dsFejlec = Report.GetDataSource("Fejlec"); dsFejlec.Init(); DataSourceBase dsOsztaly = Report.GetDataSource("Osztaly"); Data1.DataSource = dsOsztaly; Relation relFO = new Relation(); relFO.ParentDataSource = dsFejlec; relFO.ChildDataSource = dsOsztaly; relFO.ParentColumns = new string[] {"OsztalyId"}; relFO.ChildColumns = new string[] {"OsztalyId"}; Report.Dictionary.Relations.Add(relFO); dsOsztaly.Init(dsFejlec); DataSourceBase dsTanulok = Report.GetDataSource("Tanulo"); Data2.DataSource = dsTanulok; Relation relOT = new Relation(); relOT.ParentDataSource = dsOsztaly; relOT.ChildDataSource = dsTanulok; relOT.ParentColumns = new string[] {"OsztalyId"}; relOT.ChildColumns = new string[] {"OsztalyId"}; Report.Dictionary.Relations.Add(relOT); dsTanulok.Init(dsOsztaly); DataSourceBase dsOsztalyzatok = Report.GetDataSource("Osztalyzatok"); Data3.DataSource = dsOsztalyzatok; Relation relTO = new Relation(); relTO.ParentDataSource = dsTanulok; relTO.ChildDataSource = dsOsztalyzatok; relTO.ParentColumns = new string[] {"TanuloId", "TanuloCsoportId"}; relTO.ChildColumns = new string[] {"TanuloId", "TanuloCsoportId"}; Report.Dictionary.Relations.Add(relTO); dsOsztalyzatok.Init(dsTanulok); DataSourceBase dsSzoveges = Report.GetDataSource("Szoveges"); Data4.DataSource = dsSzoveges; Relation relTSz = new Relation(); relTSz.ParentDataSource = dsTanulok; relTSz.ChildDataSource = dsSzoveges; relTSz.ParentColumns = new string[] {"TanuloId", "TanuloCsoportId"}; relTSz.ChildColumns = new string[] {"TanuloId", "TanuloCsoportId"}; Report.Dictionary.Relations.Add(relTSz); dsSzoveges.Init(dsTanulok); string alulirottMegnevezese = Report.Parameters.FindByName("AlulirottMegnevezese").Value.ToString(); int index = alulirottMegnevezese.IndexOf(" - "); string nev = alulirottMegnevezese.Substring(0, index).Trim(); string beosztas = alulirottMegnevezese.Substring(index + " - ".Length).Trim(); Text7.Text = nev; Text1.Text = beosztas; } private void SzovegesDataTable_ManualBuild(object sender, EventArgs e) { string ertekeles = Report.GetColumnValue("Szoveges.Ertekeles").ToString(); string[] darabok = ertekeles.Split("|".ToCharArray()); Cell653.RowSpan = darabok.Length; Cell654.RowSpan = darabok.Length; Cell655.RowSpan = darabok.Length; for (int i = 0; i < darabok.Length; i++) { SzovegesDataTable.PrintRow(0); SzovegesDataTable.PrintColumn(0); SzovegesDataTable.PrintColumn(1); SzovegesDataTable.PrintColumn(2); Match match = Regex.Match(darabok[i], "^sz\\<sup\\>\\d+\\</sup\\> +", RegexOptions.None); if (match.Success) { Cell100067.Text = darabok[i].Substring(0, match.Length); Cell100067.ColSpan = 1; Cell100067.Border.Lines = BorderLines.Left; Cell656.Border.Lines = BorderLines.Right; if (i == 0) { Cell100067.Border.Lines |= BorderLines.Top; Cell656.Border.Lines |= BorderLines.Top; } if (i == (darabok.Length - 1)) { Cell100067.Border.Lines |= BorderLines.Bottom; Cell656.Border.Lines |= BorderLines.Bottom; } Cell656.Text = darabok[i].Substring(match.Length); } else { Cell100067.Text = darabok[i]; Cell100067.ColSpan = 2; Cell100067.Border.Lines = BorderLines.All; Cell656.Text = ""; Cell656.Border.Lines = BorderLines.None; } SzovegesDataTable.PrintColumn(3); SzovegesDataTable.PrintColumn(4); } } private void Data6_AfterPrint(object sender, EventArgs e) { if ((Data2.DataSource.RowCount % 2) != 0) { Engine.StartNewColumn(); } } } }