Vertically Centering Report on Printout

3 posts, 1 answers
  1. Jeremy
    Jeremy avatar
    4 posts
    Member since:
    Jan 2019

    Posted 08 May 2019 Link to this post

    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. Jeremy
    Jeremy avatar
    4 posts
    Member since:
    Jan 2019

    Posted 09 May 2019 in reply to Jeremy Link to this post

    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?

  3. Answer
    Todor avatar
    511 posts

    Posted 13 May 2019 Link to this post

    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.

    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
Back to Top