Hi,
I have created a WebForms solution to create a mrt file (the designer is not supported in MVC) and have been able to load that in my MVC project. So I have exported my sample data to Excel as was my objective. You were right. It was the mrt file that was wrong. Thank you for your advice.
So, just to be absolutely sure, to render a report you need an mrt file ór you need the code similar you provided in your example
Code: Select all
//Create TitleBand
StiHeaderBand TitleBand = new StiHeaderBand();
TitleBand.Height = 0.85;
TitleBand.Name = "TitleBand";
page.Components.Add(TitleBand);
//Create Title text on header
StiText headerText = new StiText(new RectangleD(0, 0, page.Width, 0.85));
headerText.Text = "Tacticdescription";
headerText.HorAlignment = StiTextHorAlignment.Left;
headerText.Name = "TitleHeader";
headerText.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold);
TitleBand.Components.Add(headerText);
//Create HeaderBand
StiHeaderBand headerBand = new StiHeaderBand();
headerBand.Height = 0.5;
headerBand.Name = "HeaderBand";
page.Components.Add(headerBand);
//Create Databand
StiDataBand dataBand = new StiDataBand();
dataBand.DataSourceName = "Categories";
dataBand.Height = 0.5;
dataBand.Name = "DataBand";
page.Components.Add(dataBand);
double pos = 0;
double columnWidth = page.Width/dt.Columns.Count;
int nameIndex = 1;
foreach (DataColumn dataColumn in dt.Columns)
{
//Create text on header
StiText hText = new StiText(new RectangleD(pos, 0, columnWidth, 0.5));
hText = new StiText(new RectangleD(pos, 0, columnWidth, 0.5));
hText.Text.Value = dataColumn.Caption;
hText.HorAlignment = StiTextHorAlignment.Center;
hText.Name = "HeaderText" + nameIndex.ToString();
hText.Brush = new StiSolidBrush(Color.Orange);
hText.Border.Side = StiBorderSides.All;
headerBand.Components.Add(hText);
StiText dataText = new StiText(new RectangleD(pos, 0, columnWidth, 0.5));
dataText.Text = "{shiporder." + Stimulsoft.Report.CodeDom.StiCodeDomSerializator.ReplaceSymbols(dataColumn.ColumnName) + "}";
dataText.Name = "DataText" + nameIndex.ToString();
dataText.Border.Side = StiBorderSides.All;
dataBand.Components.Add(dataText);
pos = pos + columnWidth;
nameIndex++;
}
report.Compile();
Have I understood this correctly, you need either an mrt file or code? Without both the report doesn't 'know' which data to show so the report will be empty. It doesn't show all?
Thanks again for your help.