unable to load and view saved MDC report file
Posted: Wed Sep 17, 2008 7:46 am
The below code is used to savedocument. The document successfuly saved but it was not loaded the actual saved document.
--------------------------
StiReport report = new StiReport();
report.RegData(_ds);
report.Dictionary.Synchronize();
StiPage page = report.Pages[0];
//Create HeaderBand
StiHeaderBand headerBand = new StiHeaderBand();
headerBand.Height = 0.5;
headerBand.Name = "HeaderBand";
page.Components.Add(headerBand);
//Create text on header
StiText headerText = new StiText(new RectangleD(0, 0, 5, 0.5));
headerText.Text = "Name";
headerText.HorAlignment = StiTextHorAlignment.Center;
headerText.Name = "HeaderText";
headerText.Brush = new StiSolidBrush(Color.LightGreen);
headerBand.Components.Add(headerText);
//Create Databand
StiDataBand dataBand = new StiDataBand();
dataBand.DataSourceName = "Student";
dataBand.Height = 0.5;
dataBand.Name = "DataBand";
page.Components.Add(dataBand);
//Create text
StiText dataText = new StiText(new RectangleD(0, 0, 5, 0.5));
dataText.Text = "{Line}.{Student.StudentName}";
dataText.Name = "DataText";
dataBand.Components.Add(dataText);
//Create FooterBand
StiFooterBand footerBand = new StiFooterBand();
footerBand.Height = 0.5;
footerBand.Name = "FooterBand";
page.Components.Add(footerBand);
//Create text on footer
StiText footerText = new StiText(new RectangleD(0, 0, 5, 0.5));
footerText.Text = "Count - {Count()}";
footerText.HorAlignment = StiTextHorAlignment.Right;
footerText.Name = "FooterText";
footerText.Brush = new StiSolidBrush(Color.LightGreen);
footerBand.Components.Add(footerText);
report.Render(false);
report.SaveDocument("D:\\" + "myTestRep" + ".mdc");
report.SavePackedReport("D:\\" + "myTestRep" + ".mdc");
report.LoadDocument("D:\\" + "myTestRep" + ".mdc");
report.LoadPackedDocument("D:\\" + "myTestRep" + ".mdc");
--------------------------
StiReport report = new StiReport();
report.RegData(_ds);
report.Dictionary.Synchronize();
StiPage page = report.Pages[0];
//Create HeaderBand
StiHeaderBand headerBand = new StiHeaderBand();
headerBand.Height = 0.5;
headerBand.Name = "HeaderBand";
page.Components.Add(headerBand);
//Create text on header
StiText headerText = new StiText(new RectangleD(0, 0, 5, 0.5));
headerText.Text = "Name";
headerText.HorAlignment = StiTextHorAlignment.Center;
headerText.Name = "HeaderText";
headerText.Brush = new StiSolidBrush(Color.LightGreen);
headerBand.Components.Add(headerText);
//Create Databand
StiDataBand dataBand = new StiDataBand();
dataBand.DataSourceName = "Student";
dataBand.Height = 0.5;
dataBand.Name = "DataBand";
page.Components.Add(dataBand);
//Create text
StiText dataText = new StiText(new RectangleD(0, 0, 5, 0.5));
dataText.Text = "{Line}.{Student.StudentName}";
dataText.Name = "DataText";
dataBand.Components.Add(dataText);
//Create FooterBand
StiFooterBand footerBand = new StiFooterBand();
footerBand.Height = 0.5;
footerBand.Name = "FooterBand";
page.Components.Add(footerBand);
//Create text on footer
StiText footerText = new StiText(new RectangleD(0, 0, 5, 0.5));
footerText.Text = "Count - {Count()}";
footerText.HorAlignment = StiTextHorAlignment.Right;
footerText.Name = "FooterText";
footerText.Brush = new StiSolidBrush(Color.LightGreen);
footerBand.Components.Add(footerText);
report.Render(false);
report.SaveDocument("D:\\" + "myTestRep" + ".mdc");
report.SavePackedReport("D:\\" + "myTestRep" + ".mdc");
report.LoadDocument("D:\\" + "myTestRep" + ".mdc");
report.LoadPackedDocument("D:\\" + "myTestRep" + ".mdc");