This is a migrated thread and some comments may be shown as answers.

Vertically Centering Report on Printout

2 Answers 56 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 08 May 2019, 09:40 PM

Does anyone know of any way of vertically centering a report (header, body and footer)?

I have a report whose body is between 1 and 25 lines.  When the report is 25 lines it takes almost the entire page up, and when 1 line almost nothing on the page.  

The client has requested the report be centered vertically.

 

First I checked the report designers page settings and properties.  And I don't see anything that looks like it does what I want.

I then checked the PrinterSettings and StandardPrintController for a setting that would do this.  And I don't see an option for what I want.

 

Is the only way to do this to figure out the number of lines, calculate the top margin and change that during runtime?  

2 Answers, 1 is accepted

Sort by
0
Jeremy
Top achievements
Rank 1
answered on 09 May 2019, 03:12 PM

Is there a way of converting a TypeReportSource to an actual report?

I was planning on using this method to Change margin at runtime.  But that link is working on a report and we're using a report source.  The reason we are using a report source is so we can render directly to a PDF without requiring a viewer. The code we got from programmatic exporting .  

So if I am working with a report source how can I center the report vertically?  Am I going to have to change my back end code to use a report instead of report source so I can use pageSettings... but if I do that can I still render directly to a PDF?

0
Accepted
Todor
Telerik team
answered on 13 May 2019, 01:06 PM
Hi Jeremy,

Indeed, it will be necessary to adjust the section containing the data according to the number of rows. It will be necessary to instantiate the particular report and pass it to the ReportProcessor as an InstanceReportSource. Vertical centering of report sections content is not supported out of the box.

I have attached a sample Console Application demonstrating the approach - it is centering a Table with respect to the Panel it is in. The PDF document will be generated in the user temp folder, e.g. 'C:\Users\username\AppData\Local\Temp'.

You may also instantiate the report by the TypeName provided in the TypeReportSource, for example by using the Activator.CreateInstance() method :

Telerik.Reporting.Report reportInstance = (Telerik.Reporting.Report)Activator.CreateInstance(assemblyName, typeName).Unwrap();

The assemblyName and typeName may be extracted from the TypeReportSource.TypeName, which is the AssemblyQualifiedName of the report.

Regards,
Todor
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Jeremy
Top achievements
Rank 1
Todor
Telerik team
Share this question
or