Page 1 of 2

How to apply a conditional margin to a textbox?

Posted: Tue Oct 12, 2010 11:18 am
by rezanew
Hello,

I want to have a conditional margin for a textbox in such a way that check for an "IF" condition and apply different margins related to the condition result.
Is it possible and how?

Thanks

How to apply a conditional margin to a textbox?

Posted: Tue Oct 12, 2010 12:32 pm
by Jan
Hello,

You can use following script in BeforePrintEvent of text component:

Code: Select all

if (condition)Text1.Margins = new Stimulsoft.Report.Components.StiMargins(1, 2, 3, 4);
else if (condition)Text1.Margins = new Stimulsoft.Report.Components.StiMargins(0, 0, 0, 0);
Thank you.

How to apply a conditional margin to a textbox?

Posted: Tue Oct 12, 2010 1:20 pm
by rezanew
Thanks for you fast reply,

My condition is different in each row so the textbox margins may have different values in each row. but in your suggested solution, the final condition in the last row is checked and the related margin is applied to all of the rows.. in other words only the last row's condition defines the margin for all of the rows...

How to apply a conditional margin to a textbox?

Posted: Wed Oct 13, 2010 1:23 am
by rezanew
There is no solution?

How to apply a conditional margin to a textbox?

Posted: Wed Oct 13, 2010 3:28 am
by Alex K.
Hello,
rezanew wrote:My condition is different in each row so the textbox margins may have different values in each row. but in your suggested solution, the final condition in the last row is checked and the related margin is applied to all of the rows.. in other words only the last row's condition defines the margin for all of the rows...
Please send us your .mrt file with database for analysis on support@stimulsoft.com.
Could you explain your issue in more details?

Thank you.

Re: How to apply a conditional margin to a textbox?

Posted: Fri Nov 23, 2018 12:59 pm
by tpontow
Any solution for that Topic? Stimulsoft is still behaving in the same way today!

I tried to set a different margin (10 instead of 5) for a text component only on second line. But it does not work. All lines are affected.

Code: Select all

if (Line == 2)DataTabelle1_Konto.Margins = new Stimulsoft.Report.Components.StiMargins(20,0,0,0);
else DataTabelle1_Konto.Margins = new Stimulsoft.Report.Components.StiMargins(5,0,0,0);
Thanks
Thorsten Pontow

Re: How to apply a conditional margin to a textbox?

Posted: Fri Nov 23, 2018 10:04 pm
by Lech Kulikowski
Hello,

Please send us a sample report with test data which reproduces the issue for analysis

Thank you.

Re: How to apply a conditional margin to a textbox?

Posted: Mon Nov 26, 2018 7:33 am
by tpontow
Take any sample Report and set that above code to BeforePrint-Event of any text component you like.

Re: How to apply a conditional margin to a textbox?

Posted: Thu Nov 29, 2018 9:16 am
by Lech Kulikowski
Hello,

Please check the following code:

Code: Select all

Text1.Properties = Text1.Properties.Clone() as Stimulsoft.Base.StiRepositoryItems;
if (Line > 3) Text1.Margins = new Stimulsoft.Report.Components.StiMargins(20, 0, 0, 0);
else Text1.Margins = new Stimulsoft.Report.Components.StiMargins(0, 0, 0, 0);
Thank you.

Re: How to apply a conditional margin to a textbox?

Posted: Thu Nov 29, 2018 9:43 am
by tpontow
Hi Lech,

that solution works. Great! Thanks for your kind help and support.

Best regards
Thorsten Pontow