Page 1 of 1

Can i rotate a SubReport?

Posted: Tue Jul 05, 2016 1:54 pm
by dedeu3
Hello people!

I have a question, i'm making a Nutrition Facts from a product, but i'm facing a problem at the moment.
The sticker that will receive the impression is rotated in 90º degrees, so the entire report must be rotated in 90º
So i rotated the text in 90º and everything became ok.

The problem is that the main Report have a subReport, and the subReport cannot be rotated in 90º
Can someone help me please?
This is the Result
Image

What happens if rotate the subReport in 90º
Image

Re: Can i rotate a SubReport?

Posted: Tue Jul 05, 2016 5:20 pm
by Alex K.
Hello,

Please send us your report with test data. We will try to prepare the sample code which will rotate pages.

Thank you.

Re: Can i rotate a SubReport?

Posted: Tue Jul 05, 2016 5:35 pm
by dedeu3
Aleksey wrote:Hello,

Please send us your report with test data. We will try to prepare the sample code which will rotate pages.

Thank you.
Here it is! Thanks !
http://www.mediafire.com/download/ydnfd ... %A3es+.mrt

Re: Can i rotate a SubReport?

Posted: Wed Jul 06, 2016 6:55 am
by Alex K.
Hello,

Thank you for the report. We need some time for prepare a solution for you.

Re: Can i rotate a SubReport?

Posted: Wed Jul 06, 2016 10:58 am
by dedeu3
Thanks! I appreciate the help a lot!

Re: Can i rotate a SubReport?

Posted: Wed Jul 06, 2016 9:51 pm
by Ivan
Hello,

Please do the following:

- write the string "rotate" in the Tag property of the SubReport1 and all components from the SubReport1 (Text46, Text47, Text48).

- write the following script in the EndRender event of the report:

Code: Select all

foreach (StiPage page in this.RenderedPages)
{
    StiComponent cont = null;
    foreach (StiComponent comp in page.Components)
    {
        if (comp.Name == "SubReport1") cont = comp.Clone() as StiComponent;
    }
    foreach (StiComponent comp in page.Components)
    {
        if ((comp.TagValue != null) && comp.TagValue.ToString().Contains("rotate"))
        {
            double newX = cont.Left + (comp.Top - cont.Top);
            double newY = cont.Top + (cont.Right - comp.Right);
            comp.Left = newX;
            comp.Top = newY;
            double tempWidth = comp.Width;
            comp.Width = comp.Height;
            comp.Height = tempWidth;
            if (comp is StiText) (comp as StiText).Angle = 90;
        }
    }
}
Thank you.