Can i rotate a SubReport?

Stimulsoft Reports.NET discussion
Post Reply
dedeu3
Posts: 4
Joined: Tue Apr 26, 2016 5:07 pm

Can i rotate a SubReport?

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Can i rotate a SubReport?

Post 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.
dedeu3
Posts: 4
Joined: Tue Apr 26, 2016 5:07 pm

Re: Can i rotate a SubReport?

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Can i rotate a SubReport?

Post by Alex K. »

Hello,

Thank you for the report. We need some time for prepare a solution for you.
dedeu3
Posts: 4
Joined: Tue Apr 26, 2016 5:07 pm

Re: Can i rotate a SubReport?

Post by dedeu3 »

Thanks! I appreciate the help a lot!
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: Can i rotate a SubReport?

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