select report columns by end user

Stimulsoft Reports.WEB discussion
farhad.websman
Posts: 1
Joined: Mon Dec 24, 2012 12:56 pm

select report columns by end user

Post by farhad.websman »

hi,i have a stimulsoft report file
i want show the report culmns checkbox list programically and after selection,show the selected columns in report
is there a way to do this?
i can not find a way to get sti Report columns
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: select report columns by end user

Post by HighAley »

Hello.

Which version do you use?

Thank you.
Abbas
Posts: 27
Joined: Tue Oct 13, 2015 2:10 pm

Re: select report columns by end user

Post by Abbas »

I want to do like this...
what do i do for this one????
i use stimulsoft 2015.2 in my mvc app...
thanks
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: select report columns by end user

Post by Alex K. »

Hello,

Please check the sample report in the attachment.

Thank you.
Attachments
SelectingColumnsWithVariable_NotCode.mrt
(17.91 KiB) Downloaded 261 times
Abbas
Posts: 27
Joined: Tue Oct 13, 2015 2:10 pm

Re: select report columns by end user

Post by Abbas »

Hello
thanks Aleksey
but i want to that end user select columns in program not in report....
can i show list of columns in c# code???and make visible and invisible unselected/selected columns in report from c# code???
can you send me sample code??
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: select report columns by end user

Post by Alex K. »

Hello,

Please check the sample report in the attachment. You can find the code in the BeforePrint event of the Page1.

Thank you.
Attachments
SelectingColumnsWithVariable.mrt
(40.38 KiB) Downloaded 252 times
Abbas
Posts: 27
Joined: Tue Oct 13, 2015 2:10 pm

Re: select report columns by end user

Post by Abbas »

Hello
I use this story for select columns by end user and i have problem:
i desiend a form for user that see all columns of report
user can select column
in my controller... columns that user didnt select been width=0 and enable=false
my code in controller

Code: Select all

 foreach (var col in unselectCols)
                {
                    var component = report.GetComponents()[col] as StiText;
                    var componenth = report.GetComponents()[col] as StiText;
                    if (component != null && componenth != null)
                    {
                        component.Enabled = false;
                        componenth.Enabled = false;
                        component.Shift = true;
                        componenth.Shift = true;
                        component.ShiftMode = StiShiftMode.DecreasingSize;
                        componenth.ShiftMode = StiShiftMode.DecreasingSize;
                        component.Width = 0;
                        componenth.Width = 0;
                    }
                }
then
i write these code:

Code: Select all

 foreach (StiComponent comp in dataBand.Components)
                {
                    if (!comp.Enabled)
                    {
                        continue;
                    }
                    width += comp.Width;
                    comp.Shift = true;
                    comp.ShiftMode = StiShiftMode.IncreasingSize;
                }
                foreach (StiComponent comp in headerBand.Components)
                {
                    if (!comp.Enabled)
                    {
                        continue;
                    }
                    comp.Shift = true;
                    comp.ShiftMode = StiShiftMode.IncreasingSize;
                }
                var factor = width / dataBand.Width;
                foreach (var comp in headerBand.Components.Cast<StiComponent>().Where(comp => comp.Enabled))
                {
                    comp.Width /= factor;
                }
                foreach (var comp in dataBand.Components.Cast<StiComponent>().Where(comp => comp.Enabled))
                {
                    comp.Width /= factor;
                }
but when 2nd or 3rd (except 1st ) column select by user.... report has blank space between column(2nd picture).... how i can delete this space???

but when user select 1st column every thing is good....
(1st picture)
Attachments
Capture333.JPG
Capture333.JPG (29.63 KiB) Viewed 2567 times
Capture22.JPG
Capture22.JPG (54.54 KiB) Viewed 2567 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: select report columns by end user

Post by Alex K. »

Hello,

Please send us a sample which reproduces the issue for analysis.

Thank you.
Abbas
Posts: 27
Joined: Tue Oct 13, 2015 2:10 pm

Re: select report columns by end user

Post by Abbas »

Hello
I find Out why space create between some columns.....

I could set "Left" property to true value....
for example for first column set to 0 and for second set to"1st column width"
thanks
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: select report columns by end user

Post by Alex K. »

Hello,

We are always glad to help you!

Thank you.
Post Reply