You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
3.8 KiB
116 lines
3.8 KiB
using CrystalDecisions.CrystalReports.Engine;
|
|
using CrystalDecisions.ReportSource;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Data;
|
|
|
|
namespace QW2021C.Reporting
|
|
{
|
|
public partial class rdlc : System.Web.UI.Page
|
|
{
|
|
protected void Page_Init(object sender, EventArgs e)
|
|
{
|
|
DataSet ds = new DataSet();
|
|
ds.ReadXml(Server.MapPath("~\\Workdir\\Daten.xml"));
|
|
string ortliste = "";
|
|
foreach (DataRow dr in ds.Tables[0].Rows)
|
|
{
|
|
if (ortliste != "") ortliste = ortliste + ";";
|
|
ortliste = ortliste + dr[0].ToString();
|
|
|
|
}
|
|
|
|
DataTable dt = new DataTable();
|
|
foreach (DataColumn c in ds.Tables[1].Columns)
|
|
{
|
|
if (c.ColumnName.ToString() == "Rang" || c.ColumnName.ToString() == "BestPunkte")
|
|
{
|
|
dt.Columns.Add(c.ColumnName, System.Type.GetType("System.Int32"));
|
|
}
|
|
else
|
|
{
|
|
dt.Columns.Add(c.ColumnName);
|
|
}
|
|
}
|
|
|
|
foreach (DataRow dr in ds.Tables[1].Rows)
|
|
{
|
|
dt.ImportRow(dr);
|
|
}
|
|
|
|
//DataSet dsnew = new DataSet();
|
|
//dsnew.Tables.Add(dt.Copy());
|
|
//dsnew.WriteXml(Server.MapPath("~\\workdir\\daten.xml"));
|
|
|
|
string[] splitter = ortliste.Split(';');
|
|
string rptfilename = Server.MapPath("~\\Resultate\\Reports\\Rpt_Auswertung_Gesamt.rpt");
|
|
ReportDocument cr = new ReportDocument();
|
|
cr.Load(rptfilename);
|
|
//cr.SetDatabaseLogon("sa", "*shu29", "shu00", "qw2021");
|
|
//rystalReportViewer1.ReportSource = cr;
|
|
//return;
|
|
int i;
|
|
for (i = 1; i <= 8; i++)
|
|
{
|
|
CrystalDecisions.CrystalReports.Engine.TextObject MyTextObject;
|
|
MyTextObject = cr.ReportDefinition.ReportObjects["Text" + i.ToString()] as TextObject;
|
|
MyTextObject.Text = "";
|
|
try
|
|
{
|
|
MyTextObject.Text = splitter[i - 1].ToString();
|
|
}
|
|
catch
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
cr.SetDataSource(dt);
|
|
CrystalReportViewer1.ReportSource = cr;
|
|
CrystalReportViewer1.RefreshReport();
|
|
|
|
CrystalDecisions.Shared.ConnectionInfo ci = new CrystalDecisions.Shared.ConnectionInfo();
|
|
//ci.ServerName = Server.MapPath("~\\workdir\\reportdata.xml");
|
|
//ci.DatabaseName = "_data";
|
|
//ci.UserID = "";
|
|
//ci.Password = "";
|
|
//CrystalDecisions.Shared.TableLogOnInfo tl = new CrystalDecisions.Shared.TableLogOnInfo();
|
|
//foreach (CrystalDecisions.CrystalReports.Engine.Table t in cr.Database.Tables)
|
|
//{
|
|
// t.LogOnInfo.ConnectionInfo = ci;
|
|
//}
|
|
|
|
|
|
|
|
|
|
//cr.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.CrystalReport, Server.MapPath("~\\Workdir\\output.rpt"));
|
|
//ReportDocument cr1 = new ReportDocument();
|
|
//cr.Load(Server.MapPath("~\\Workdir\\output.rpt"));
|
|
//Session.Add("rptdoc", cr);
|
|
//CrystalReportViewer1.ReportSource = Session["rptdoc"];
|
|
|
|
|
|
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (Page.IsPostBack == true) return;
|
|
}
|
|
|
|
}
|
|
|
|
//private TextObject TextObject()
|
|
//{
|
|
// throw new NotImplementedException();
|
|
//}
|
|
|
|
//ReportDocument cryRpt = new ReportDocument();
|
|
//cryRpt.Load(Server.MapPath("~\\Reports\\CrystalReport1.rpt"));
|
|
// CrystalReportViewer1.ReportSource = cryRpt;
|
|
//}
|
|
|
|
} |