I want to read the current dataset from Dictionary or DataSources, which was printed.
I tryed this in the following event
Code: Select all
StiGroupFooterBand stiGroupFooterZahlschein = (StiGroupFooterBand) Report.CompiledReport.GetComponents()["GroupFooterZahlschein"];
if (stiGroupFooterZahlschein != null) {
stiGroupFooterZahlschein.AfterPrint += new EventHandler(OnGroupFooterZahlschein_AfterPrint);
}
.....
private void OnGroupFooterZahlschein_AfterPrint(object sender, EventArgs e) {
if (Report.CompiledReport.IsSecondPass) {
int aktPosition = Report.CompiledReport.DataSources["Vorschreibung_Vorschreibungen_Empfaenger"].Position;
var empfaenger = Report.CompiledReport.DataSources["Vorschreibung_Vorschreibungen_Empfaenger"];
string vorname = empfaenger.DataTable.Rows[aktPosition].ItemArray[1].ToString();
string nachname = empfaenger.DataTable.Rows[aktPosition].ItemArray[2].ToString();
int pNr = Report.CompiledReport.PageNumber;
int pNrTotoal = Report.CompiledReport.TotalPageCount;
}
}
because it is sorted different. Is it possible to read the correct dataset?
When I try this in the code in designer it works fine and I have always the current dataset as the foliowing example shows:
Code: Select all
...
using System.Collections.Generic;
namespace Reports
{
public class ZahlscheinVorschreibung: Stimulsoft.Report.StiReport
{
public List<string> DuZuMetaDaten;
private string duzuMetadaten;
public ZahlscheinVorschreibung()
{
this.InitializeComponent();
GroupFooterZahlschein.AfterPrint += GroupFooterZahlschein_AfterPrint;
DuZuMetaDaten = new List<string>();
Dictionary.Variables.Add(new Stimulsoft.Report.Dictionary.StiVariable("", "DuZuMetaDaten", "DuZuMetaDaten", "", typeof(List<string>), "", false, Stimulsoft.Report.Dictionary.StiVariableInitBy.Value, false));
}
void GroupFooterZahlschein_AfterPrint(object sender, EventArgs e) {
if (IsSecondPass) {
duzuMetadaten = string.Format("{0}|{1}|{2}", PageNumber,
Vorschreibung_Vorschreibungen.Empfaenger.FirstName,
Vorschreibung_Vorschreibungen.Empfaenger.LastName);
DuZuMetaDaten.Add(duzuMetadaten);
}
}
#region StiReport Designer generated code - do not modify
....