Hello,
I tried to get the content of StiText component in the DataBand.AfterPrint Event.
Here the codesnipes what I used:
StiReport report = new StiReport();
LoadReport(report);
data = Utils.GetData();
report.RegData("Daten", data);
report.Compile();
StiDataBand dataBand = (StiDataBand) report.CompiledReport.GetComponents()["DataBand"];
dataBand.AfterPrint += dataBand_AfterPrint;
report.ShowWithWpf();
Here the Methode for the event:
void dataBand_AfterPrint(object sender, EventArgs e) {
StiDataBand dataBand = (StiDataBand) sender;
// I have to read a StiText component, its content is a path for images
string imagePath = (dataBand.GetComponents()["MyPicturePath"] as StiText).Text.Value;
// searching ImageObject in DataBand
StiImage stiImage = (StiImage) dataBand.GetComponents()["MyPicture"];
System.Drawing.Image image = System.Drawing.Image.FromFile(data.ElementAt(index).BildPfad);
// make picture small
System.Drawing.Image smallImage = getSmallPicture(image);
stiImage.Image = smallImage ;
}
The problem is, that the imagePath (Text.Value) is always empty!
Reading content of StiText during DataBand.AfterPrint Event
Re: Reading content of StiText during DataBand.AfterPrint Ev
Hello,
In this case, you get the value from the report template.
Please try to use the following code:
Thank you.
In this case, you get the value from the report template.
Please try to use the following code:
Code: Select all
object renderedText;
...
report.Compile();
var dataBand = report.CompiledReport.GetComponentByName("DataBand1") as StiDataBand;
var stiText = report.CompiledReport.GetComponentByName("Text1") as StiText;
stiText.GetTag += StiText_GetTag;
dataBand.AfterPrint += DataBand_AfterPrint;
...
private void DataBand_AfterPrint(object sender, EventArgs e)
{
// I have to read a StiText component, its content is a path for images
string imagePath = (renderedText as StiText).Text;
...
}
Re: Reading content of StiText during DataBand.AfterPrint Ev
Hello Aleksey!
Sorry but I don't understand the following codeparts of your answer.
stiText.GetTag += StiText_GetTag; ... where I do need this
string imagePath = (renderedText as StiText).Text; ... this don't work, I beleave
You might have an example for me, where reading StiText content during rendering?
Thank you
Sorry but I don't understand the following codeparts of your answer.
stiText.GetTag += StiText_GetTag; ... where I do need this
string imagePath = (renderedText as StiText).Text; ... this don't work, I beleave
You might have an example for me, where reading StiText content during rendering?
Thank you
Re: Reading content of StiText during DataBand.AfterPrint Ev
Hello,
This event needed for getting an object from the rendered report, not from the template.
Please send us a simple project which reproduces the issue for analysis.
Thank you.
This event needed for getting an object from the rendered report, not from the template.
Please send us a simple project which reproduces the issue for analysis.
Thank you.
- Attachments
-
- Capture.PNG (49.82 KiB) Viewed 3474 times
Re: Reading content of StiText during DataBand.AfterPrint Ev
Hello Aleksey,
this was the missing link
Now it is working fine.
Thank you
this was the missing link
Code: Select all
void stiText_GetTag(object sender, StiValueEventArgs e) {
renderText = sender;
}
Thank you
Re: Reading content of StiText during DataBand.AfterPrint Ev
Hello
We are always glad to help you!
Please let us know if you need any additional help.
Thank you.
We are always glad to help you!
Please let us know if you need any additional help.
Thank you.