вот таким кодом динамически создаю колонки в в репорте:
Код: Выделить всё
StiDataBand dataBand = new StiDataBand();
dataBand.DataSourceName = "ds1";
dataBand.Height = 0.2;
dataBand.CanGrow = true;
dataBand.Name = "DataBand";
dataBand.OddStyle = "oddStyle";
dataBand.EvenStyle = "evenStyle";
page.Components.Add(dataBand);
startpoint = 0.0;
StiText dataText = null;
System.Drawing.Font bodyFont = new System.Drawing.Font("Verdrana", 7.5F, System.Drawing.FontStyle.Regular);
foreach (DataRow ri in cls.Rows)
{
if ((bool)ri["Checked"])
{
dataText = new StiText(new RectangleD(startpoint, 0, double.Parse(ri["width"].ToString()), 0.5));
dataText.Text = "{ds1." + (string)ri["id"] + "}";
dataText.Name = (string)ri["id"] + "SS";
dataText.Font = bodyFont;
dataText.WordWrap = true;
dataText.GrowToHeight = true;
dataText.Margins = margins;
string ss = (string)ri["datatype"];
if (ss != "")
{
if (ss == "smalldatetime")
{
dataText.TextFormat = new Stimulsoft.Report.Components.TextFormats.StiDateFormatService("dd.MM.yyyy", String.Empty);
}
if (ss == "time")
{
dataText.TextFormat = new Stimulsoft.Report.Components.TextFormats.StiDateFormatService("HH:mm", String.Empty);
}
if (ss == "money")
{
dataText.TextFormat = new Stimulsoft.Report.Components.TextFormats.StiCurrencyFormatService(1, 5, ",", 2, " ", 3, "", true, true, " ");
}
if (ss == "list")
{
dataText.Text = "{MakeListFromXml.ListFromXml(ds1." + (string)ri["id"] + ".ToString())}";
}
}
dataText.HorAlignment = StiTextHorAlignment.Center;
dataText.VertAlignment = StiVertAlignment.Center;
dataText.Border.Style = StiPenStyle.Solid;
dataText.Border.Color = Color.Black;
dataText.Border.Side = StiBorderSides.All;
dataBand.Components.Add(dataText);
startpoint += double.Parse(ri["width"].ToString());
}
}
report.Render(false);