Auto-shift boxes

Stimulsoft Reports.WEB discussion
Post Reply
fuhrj
Posts: 120
Joined: Wed Jun 11, 2008 12:51 pm
Location: Lancaster, Ohio

Auto-shift boxes

Post 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!
Last edited by fuhrj on Sat Aug 04, 2012 5:11 pm, edited 1 time in total.
fuhrj
Posts: 120
Joined: Wed Jun 11, 2008 12:51 pm
Location: Lancaster, Ohio

Re: Auto-shift boxes

Post 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;                
};
}
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Auto-shift boxes

Post 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.
Post Reply