I have a small report, designed and saved as .dll.
It contains some static text fields in the PageHeaderBand.
I am loading this report as below:
Code: Select all
StiReport report;
string strReportPath = "d:\myreport.dll";
report = StiReport.GetReportFromAssembly(strReportPath);
Also I am trying to add simple StiText.
The problem is that the StiText, never gets populated with the value I am setting ( I am trying with this text just for testing).
On the other hand, the table shows the correct number of columns and rows, but all cells are empty.
Is it possible to achive this scenario? Meaning to dynamically add a table to an existing report.
More code from my project:
Code: Select all
DataTable tblDR = GetData(dtStartTimeStamp);
tblDR.TableName = "tblDR";
report.RegData(tblDR);
report.RegData(tblDR);
report.Dictionary.Synchronize();
StiPage page = report.Pages[0];
StiTable table = new StiTable();
table.Name = "Table1";
table.ColumnCount = tblDR.Columns.Count;
table.RowCount = 3;
table.HeaderRowsCount = 1;
table.FooterRowsCount = 1;
table.Width = page.Width;
table.Height = page.GridSize * 12;
table.DataSourceName = String.Format("{0}", tblDR.TableName);
page.Components.Add(table);
table.CreateCell();
table.TableStyle = StiTableStyle.Style12;
int indexHeaderCell = 0;
int indexDataCell = 3;
foreach (DataColumn column in tblDR.Columns)
{
//Set text on header
StiTableCell headerCell = table.Components[indexHeaderCell] as StiTableCell;
headerCell.Text.Value = column.Caption;
headerCell.HorAlignment = StiTextHorAlignment.Center;
headerCell.VertAlignment = StiVertAlignment.Center;
StiTableCell dataCell = table.Components[indexDataCell] as StiTableCell;
string sDataCellExpresion = String.Format("{{{0}.{1}}}", tblDR.TableName, Stimulsoft.Report.CodeDom.StiCodeDomSerializator.ReplaceSymbols(column.ColumnName));
dataCell.Text.Value = sDataCellExpresion;
indexHeaderCell++;
indexDataCell++;
}
Can some one plese let me know what I am missing.
Why the table is not getting populated with data?
I gave to mention, that this report is to tbe displayed in StiWebReportViewer
Code: Select all
StiWebViewer1.Report = report;
StiWebViewer1.DataBind();