How to modify a designer generated report at runtime?
Posted: Thu Apr 15, 2010 4:25 am
In addition to my problem with modifying an image at runtime (here), I seem to have a general problem understanding how to modify anything at all in code at runtime.
I just tried it with a textbox:
The code compiles and runs, but it does nothing.
I wrote a text into the TestTextbox at designtime, but at runtime tmp.Text is empty.
My code appends the string to it (so it contains " (Test)" then), but on the exported report there is only the text that I set at design time.
I'm completely new at Stimulsoft Reports - can someone explain to me how to do it right?
We are very likely to buy Stimulsoft Reports, as soon we made sure that it can do everything that we need.
Manipulating images and text at runtime is the last thing that's missing.
Thank you!
I just tried it with a textbox:
Code: Select all
StiReport rep = new StiReport();
rep.Load("test.mrt");
DataSet ds = new DataSet();
(...) // fill Dataset
rep.RegData(ds);
rep.Compile();
foreach (object comp in rep.CompiledReport.GetComponents())
{
if (comp.GetType() == typeof(StiText))
{
StiText tmp = new StiText();
tmp = (StiText)comp;
if (tmp.Name == "TestTextbox")
{
tmp.Text = tmp.Text += " (Test)";
}
}
}
rep.Render();
rep.ExportDocument(StiExportFormat.Pdf, @"c:\test.pdf");
I wrote a text into the TestTextbox at designtime, but at runtime tmp.Text is empty.
My code appends the string to it (so it contains " (Test)" then), but on the exported report there is only the text that I set at design time.
I'm completely new at Stimulsoft Reports - can someone explain to me how to do it right?
We are very likely to buy Stimulsoft Reports, as soon we made sure that it can do everything that we need.
Manipulating images and text at runtime is the last thing that's missing.
Thank you!