Page 1 of 1

When setting margins for a component they are set globally

Posted: Fri Feb 12, 2016 2:44 pm
by ACIV
Hello there,

For some reason, whenever I set the margins of a component in code it sets them for all other components with margins - e.g.

Code: Select all

pageDescription.Margins.Top = 8;
This piece of code alone will set the top margin to 8 for alll other components. Can you please rectify this

Re: When setting margins for a component they are set global

Posted: Sat Feb 13, 2016 11:48 pm
by Jan
Hello,

This strange behavior depends on the place of your code in which you change report components margins. Maybe you do this after report rendering. If yes, then you need to try to use following code instead your:

Code: Select all

pageDescription.Margins = new StiMargins(0, 1, 2, 3);
Why do you need to create a new margins object? Report engine during report rendering use StiMargins object from report template (it does not create a copy of this object). This behavior decrease memory consumption and increase the speed of report rendering (this method is used for different properties).

Please contact us if you need any help.

Thank you.