Code: Select all
StiHeaderBand headerBand = new StiHeaderBand();
headerBand.Height = 0.5;
headerBand.Name = "HeaderBand";
page.Components.Add(headerBand);
StiDataBand dataBand = new StiDataBand();
dataBand.Height = 0.5;
dataBand.Name = "DataBand";
dataBand.BusinessObjectGuid = _report.Dictionary.BusinessObjects[_type.Name].Guid;
page.Components.Add(dataBand);
double pos = 0, columnWidth = StiAlignValue.AlignToMinGrid(page.Width / _headers.Count, 0.1, true);
int nameIndex = 1;
foreach (HeaderInfo header in _headers)
{
double width = header.Width == 0 ? columnWidth : header.Width;
StiText headerText = new StiText(new RectangleD(pos, 0, width, 0.5));
headerText.HorAlignment = StiTextHorAlignment.Center;
headerText.VertAlignment = StiVertAlignment.Center;
headerText.Text.Value = header.UIName;
headerText.Name = "HeaderText" + nameIndex;
if (nameIndex < _headers.Count)
{
headerText.Border.Side = StiBorderSides.Top | StiBorderSides.Left | StiBorderSides.Bottom;
}
else
{
headerText.Border.Side = StiBorderSides.All;
}
headerBand.Components.Add(headerText);
StiText dataText = new StiText(new RectangleD(pos, 0, width, 0.5));
dataText.VertAlignment = StiVertAlignment.Center;
dataText.Text.Value = "{" + _type.Name + "." + header.Name + "}";
dataText.Name = "DataText" + nameIndex;
if (nameIndex < _headers.Count)
{
dataText.Border.Side = StiBorderSides.Left | StiBorderSides.Bottom;
}
else
{
dataText.Border.Side = StiBorderSides.Left | StiBorderSides.Bottom | StiBorderSides.Right;
}
dataBand.Components.Add(dataText);
pos += width;
nameIndex++;
}