PRINTING TreeList Help

8 posts, 0 answers
  1. Jacob
    Jacob avatar
    1 posts
    Member since:
    Mar 2014

    Posted 18 Sep 2014 Link to this post

    I am looking to print a TreeList without having the dependency of Excel or PDF. Is there a method other than exporting the innerHTML onto a page and printing the new page?
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 23 Sep 2014 Link to this post

    Hi Jacob,

    The current version of the RadTreeList control does not provide a standalone print method for directly printing its content. Possible approach is to use the browser direct print option or any third party library for achieving such functionality.
    As you already mentioned this could be also done by firstly export the content and then print the html.

    Regards,
    Maria Ilieva
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Doug
    Doug avatar
    3 posts
    Member since:
    Aug 2014

    Posted 28 Sep in reply to Maria Ilieva Link to this post

    The innerHtml method does not export data in the required format. Can you provide a list of 3rd party libraries available to print TreeList?
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 03 Oct Link to this post

    Hello,

    You can use the Kendo UI Drwaing library for achieving the required functionality. For example:

    var that = $find("RadTreeList1");
    var kendo = window.kendo;
    var $printingContainer;
     
    if ($telerik.isIE || Telerik.Web.Browser.edge) {
        var printWindow = window.open();
     
        if (!printWindow) return false;
     
        $printingContainer = $telerik.$("<div>");
     
        kendo.drawing.drawDOM(that.get_element()).then(function (group) {
            return kendo.drawing.Surface.create($printingContainer, { type: "svg" }).draw(group);
        }).done(function (data) {
            var html = "<html><head>" + that._getHeadLinksForPrint() + "</head><body><form style='height:" + that.get_element().scrollHeight + "px;'>" +
                $printingContainer.get(0).innerHTML + "</form></body></html>";
            printWindow.document.open();
            printWindow.document.write(html);
            printWindow.document.close();
            printWindow.print();
            $printingContainer.remove();
        });
    } else {
        kendo.drawing.drawDOM(that.get_element())
        .then(function (root) {
            return kendo.drawing.exportPDF(root);
        })
        .done(function (data) {
            window.open(data, '', false);
        });
    }

    Give this a try and verify if it works for you.

    Regards,
    Maria Ilieva
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  6. Doug
    Doug avatar
    3 posts
    Member since:
    Aug 2014

    Posted 03 Oct in reply to Maria Ilieva Link to this post

    This does work when fewer items need to be printed in a collapsed state and the page size is less than 1, but the screen is blank when trying to print data after expanding all the nodes. I have attached both the screenshots below. I need to be able to print about 600 to 1000 rows sometimes. How do I make this work for large amounts of data?
  7. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 07 Oct Link to this post

    Hi Doug,

    With huge amount of records you will not be able to use this approach and you might consider using the built-in Export To PDF functionality of the RadTreeList and print the content from the generated PDF file:


    Regards,
    Konstantin Dikov
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  8. Doug
    Doug avatar
    3 posts
    Member since:
    Aug 2014

    Posted 07 Oct in reply to Konstantin Dikov Link to this post

    I want to be able to print the data from the user screen, without having to export to a separate pdf or excel file. I tried exporting the innerHTML to a new page and printing it, but that was not user friendly. Is there any other way I can do this without having to export the data to Excel, word or pdf?
  9. Kostadin
    Admin
    Kostadin avatar
    1708 posts

    Posted 12 Oct Link to this post

    Hi Doug,

    A possible solution is to manually break the pages so you can export the content in a multiple files. I would recommend you to examine the following help article which elaborates more on this matter.

    Regards,
    Kostadin
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017