ShowPageSetupDialog

5 posts, 0 answers
  1. Tomas
    Tomas avatar
    4 posts
    Member since:
    Nov 2014

    Posted 03 Oct Link to this post

    Hello,

    I use ReportViewer class and its method ShowPageSetupDialog for the page setup dialog.

    When i set some values to out of range (e.g. margins)  in the dialog, then ReportViewer shows object reference error.

    Can i prevent this situations, or catch the exception?

    Regards,
    Tomáš

     

    Exception thrown: 'System.NullReferenceException' in Telerik.Reporting.dll

    An error has occurred while rendering the report: System.NullReferenceException: Object reference not set to an instance of an object.
       at Telerik.Reporting.Paging.Table.CellAt(Int32 rowIndex, Int32 columnIndex)
       at Telerik.Reporting.Paging.Table.RenderCells(TableRegion region, RectangleRF clip, Double left, Double top, Double reservedLeft, Double reservedTop)
       at Telerik.Reporting.Paging.Table.AddChildrenToPage(RectangleRF clip)
       at Telerik.Reporting.Paging.PagingElementBase.AddToPageRecursive(RectangleRF parentClip, Double parentTop, Double parentLeft, Double parentReservedTop, Double parentReservedBottom, Double parentReservedLeft, Double parentReservedRight)
       at Telerik.Reporting.Paging.PagingElementBase.AddChildrenToPage(RectangleRF clip)
       at Telerik.Reporting.Paging.PagingElementBase.AddToPageRecursive(RectangleRF parentClip, Double parentTop, Double parentLeft, Double parentReservedTop, Double parentReservedBottom, Double parentReservedLeft, Double parentReservedRight)
       at Telerik.Reporting.Paging.PagingElementBase.AddChildrenToPage(RectangleRF clip)
       at Telerik.Reporting.Paging.Group.AddChildrenToPage(RectangleRF clip)
       at Telerik.Reporting.Paging.PagingElementBase.AddToPageRecursive(RectangleRF parentClip, Double parentTop, Double parentLeft, Double parentReservedTop, Double parentReservedBottom, Double parentReservedLeft, Double parentReservedRight)
       at Telerik.Reporting.Paging.PagingElementBase.AddChildrenToPage(RectangleRF clip)
       at Telerik.Reporting.Paging.Group.AddChildrenToPage(RectangleRF clip)
       at Telerik.Reporting.Paging.PagingElementBase.AddToPageRecursive(RectangleRF parentClip, Double parentTop, Double parentLeft, Double parentReservedTop, Double parentReservedBottom, Double parentReservedLeft, Double parentReservedRight)
       at Telerik.Reporting.Paging.PagingElementBase.AddChildrenToPage(RectangleRF clip)
       at Telerik.Reporting.Paging.Group.AddChildrenToPage(RectangleRF clip)
       at Telerik.Reporting.Paging.PagingElementBase.AddToPageRecursive(RectangleRF parentClip, Double parentTop, Double parentLeft, Double parentReservedTop, Double parentReservedBottom, Double parentReservedLeft, Double parentReservedRight)
       at Telerik.Reporting.Paging.PagingElementBase.AddChildrenToPage(RectangleRF clip)
       at Telerik.Reporting.Paging.PagingElementBase.AddToPageRecursive(RectangleRF parentClip, Double parentTop, Double parentLeft, Double parentReservedTop, Double parentReservedBottom, Double parentReservedLeft, Double parentReservedRight)
       at Telerik.Reporting.Paging.PageCompositionBase.CollectElementsAndDataForPage()
       at Telerik.Reporting.Paging.PageCompositionBase.OutputPage()
       at Telerik.Reporting.Paging.PageCompositionBase.CreatePages()
       at Telerik.Reporting.Paging.PagerBase.Telerik.Reporting.Paging.IPager.CreatePages(IPageHandler handler, Report report)
       at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback)

  2. Stef
    Admin
    Stef avatar
    3041 posts

    Posted 05 Oct Link to this post

    Hello Tomas,

    If you use the 'Page Setup' button of the WPF|WinForms ReportViewer, there is included validation. Please note that this is an external dialog used by viewers to provide options for specifying the physical pages.

    Please elaborate which Telerik Reporting version is used, and how the exceeding value for the margin is entered in the report's PageSettings.


    On a side note, errors on processing a report can be caught in the report's Error event, and in the viewer's Error event.

    Regards,
    Stef
    Telerik by Progress
    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
  3. DevCraft banner
  4. Tomas
    Tomas avatar
    4 posts
    Member since:
    Nov 2014

    Posted 06 Oct in reply to Stef Link to this post

    I have WPF app and i use the latest Telerik Reporting version 10.2.16.914. I edited template file Telerik.ReportViewer.Wpf in this app, hid default toolbar and created own. For show the Page Setup i placed the standard WPF button to the own toolbar. After click this button, i call ShowPageSetupDialog method on the report viewer object.

    When i set some big value e.g. 600 to margin, the validation dialog is shown. But when i set e.g. 50 to margin i give the object reference error. The same report in the Telerik Report Designer and its Page Setup dialog behaves correctly.

    XAML

    xmlns:telerikReporting="clr-namespace:Telerik.Reporting;assembly=Telerik.Reporting"

     <tr:ReportViewer Grid.Row="1" x:Name="ReportViewer1" ZoomPercent="{Binding SelectedZoomItem.Value,Mode=TwoWay}"  HorizontalAlignment="Stretch" ReportSource="{Binding ReportSource, Mode=TwoWay}" ViewMode="PrintPreview" cal:Message.Attach="[Event Loaded] = [Action ReportViewer_Loaded($source)]">
                    </tr:ReportViewer>

    CODE

     public void ReportViewer_Loaded(object sender)
            {
                rv = (ReportViewer) sender;         
                rv.UpdateUI += Rv_UpdateUI;        

                rv.Error += Rv_Error;

            }

    public void PrintSettings()
            {                                            
                rv.ShowPageSetupDialog();
                rv.RefreshReport();            
            }

  5. Stef
    Admin
    Stef avatar
    3041 posts

    Posted 10 Oct Link to this post

    Hi Tomas,

    The dialog that can be raised through the viewer has validation, not allowing margins to be greater than the paper size.

    Please open a support ticket and send us a demo project that reproduces the problem. Test also if the problem occurs with any report or only with such having specific layout or settings in code.

    Regards,
    Stef
    Telerik by Progress
    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
  6. Tomas
    Tomas avatar
    4 posts
    Member since:
    Nov 2014

    Posted 19 Oct in reply to Stef Link to this post

    Hi Stef,

    I upgraded Telerik Reporting to R3 2016 and add configSection to app configuration file.

    Now it is all fine.

    Thank you for help.

    Regards,

    Tomas

Back to Top
DevCraft banner