Page 1 of 1

Auto-shift boxes

Posted: Sat Aug 04, 2012 4:26 pm
by fuhrj
I am generating an invoice report that can contain a company logo. If the company logo is not supplied, then I want the address block to move to the space occupied by the logo, so that there is no empty space.

The result should look like this:

With Logo :

[LOGO: Image] [Address Block: Textbox]

Without Logo:

[Address Block]

How can I make Address Block shift to the left to occupy the logo's space when the logo is empty? I tried playing with Auto Grow and Auto Shrink but it has no effect.

Thanks!

Re: Auto-shift boxes

Posted: Sat Aug 04, 2012 5:09 pm
by fuhrj
I've answered my own question. By using the code below in the Page Rendering event, I can
shift the address block to the left when the logo is null and to the right when it is not.

Code: Select all

if (Company.logo == null) {
                Image2.Enabled = false;
                Panel1.Left = .1;
            } else {
                if (Company.logo.Length == 0) {
                    Image2.Enabled = false;
                    Panel1.Left = .1;
                } else {

                    StiReport report = new StiReport();
double imgWidth = report.Unit.ConvertToHInches(img.Width);

                    Panel1.Left = (imgWidth / 10000) + .2;                
};
}

Re: Auto-shift boxes

Posted: Mon Aug 06, 2012 6:50 am
by HighAley
Hello.

You could set the Can Shrink property of the image to true and enable Decreasing Size Shift mode of the text component.
Look at the attached report template.
Report.mrt
(4.32 KiB) Downloaded 205 times
Thank you.