PDF Export for Report with Group

Stimulsoft Ultimate discussion
Post Reply
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

PDF Export for Report with Group

Post by tpontow »

Hello Stimulsoft-Team,

when exporting a report to PDF which has a Group the small + /- Icons / images are not exported. There is a space instead.

Is it possible to

1. Show the small Icon / image in the PDF file or
2 at least get rid of the white space in the PDF where the + / - Images uesd to be?

Thanks and Kind regards
Thorsten Pontow
Attachments
A Report with a Group is exported to PDF.
A Report with a Group is exported to PDF.
ExportToPDFWithGroup.png (76.66 KiB) Viewed 6856 times
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: PDF Export for Report with Group

Post by Lech Kulikowski »

Hello,

> 1. Show the small Icon / image in the PDF file or

We do not see the point, because this feature in pdf is impossible to implement, and that icon will only occur extra questions from the user.

> 2 at least get rid of the white space in the PDF where the + / - Images uesd to be?

We do not create an empty place, but you yourself are the design of the report.
as an option - change the report in the event before export (move the necessary components to the left).

Thank you.
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

Re: PDF Export for Report with Group

Post by tpontow »

Thanks Lech,

that helped me to solve my Problem!

I overwrote OnExporting() and OnExported() i my own StiReport-Subclass as follows:

Code: Select all

protected override void OnExporting(StiExportEventArgs e)
        {
            m_marginAdjustedComponents = new List<string>();
            foreach (StiPage renderedPage in RenderedPages)
            {
                foreach (StiComponent renderedPageComponent in renderedPage.Components)
                {
                    if (renderedPageComponent is StiText textComponent && textComponent.Name.EndsWith("groupHeaderBandText"))
                    {
                        textComponent.Margins.Left = 1;
                        m_marginAdjustedComponents.Add(textComponent.Name);
                        
                    }
                }

            }

            base.OnExporting(e);

        }

        protected override void OnExported(StiExportEventArgs e)
        {
            base.OnExported(e);

            foreach (StiPage renderedPage in RenderedPages)
            {
                foreach (StiComponent renderedPageComponent in renderedPage.Components)
                {
                    if (renderedPageComponent is StiText textComponent && m_marginAdjustedComponents.Contains(textComponent.Name))
                    {
                        textComponent.Margins.Left = 12;
                        m_marginAdjustedComponents.Remove(textComponent.Name);

                    }
                }

            }
        }
Greetings
Thorsten
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: PDF Export for Report with Group

Post by Edward »

Hi Thorsten,

Amazing, it really is. Easy and efficient solution. Thank you for sharing your approach and the code snippet with the community, it will definitely help someone.

Kind Regards,
Edward
Post Reply