Page 1 of 1

How to find the text property of a textbox

Posted: Mon Feb 23, 2015 9:42 am
by gaurav2325
Hi,

I have to load all the components and there value.

For eg, below is the Xml file for the report. Now I want to read NAME and TEXT.

<Components isList="true" count="6">
<Text1 Ref="14" type="Text" isKey="true">
<Name>Text1</Name>
<Page isRef="10" />
<Parent isRef="13" />
<Text>Test Name for text</Text>
<TextBrush>Black</TextBrush>
<Type>Expression</Type>
</Text1>

I am using the following code,

StiReport Report = new StiReport();
Report .Load(Path.GetFullPath(fileName));

m_GlobalFileName = name;

StiComponentsCollection collection = Report .GetComponents();

foreach (StiComponent TextComp in collection)
{
if (TextComp is StiText)
{
messagebox.show(name + "." + TextComp.Name, TextComp.Tag);
}
}

Using the TextComp.Name, I am able to get the name of the text but not able to find the property TEXT. That should return "Test Name for text"

Please let me know, how it can be done.

Thanks

Re: How to find the text property of a textbox

Posted: Mon Feb 23, 2015 11:59 am
by HighAley
Hello.

The StiComponent class has no Text property. You should convert it to StiText.

Code: Select all

(TextComp as StiText).Text
Thank you.