Multiselection from code

Greetings, I want to ask if there's a way to do "performSelection" but for multiple objects, such as a Range of Cells and Charts, so I can send 'em to print, I understand that "performSelection" only works for cells, but how could I achive to select all the charts I have in the Spreadsheet and send them with their tables to print ?

kinda-example:

table1--------|    
=========|
=========|

chart1

table2--------|    
=========|
=========|

chart2

table3--------|    
=========|
=========|

chart3


thanks in advance!


4 Replies

CH Christian November 21, 2017 04:58 PM UTC

I believe I did the trick selecting all the cells where I need to print, but I would like to know if there're options, functions, to achive what I asked, such as print options, things like that


SP Sangeetha Priya Murugan Syncfusion Team November 23, 2017 12:18 PM UTC

Hi Christian, 
 
Thank you for using Syncfusion products. 
 
We have checked your reported query, could you please confirm that your requirement is to select table and chart separately by using “performSelection” method? And print these selected tables and charts to a single print action? 
 
Regards, 
Sangeetha Priya M 



CH Christian November 23, 2017 03:17 PM UTC

That's correct, I want to select 'em and being able to print them at once, with print selection.


SI Silambarasan I Syncfusion Team November 29, 2017 06:13 AM UTC

Hi Christian, 
 
Thanks for your update. 
 
We have checked further on your requirement and currently, we don’t have an option to print multi selection (cell ranges with chart selection) in Spreadsheet. However, we have achieved your requirement as custom sample by newly extended the method ‘customPrintSelection()’ which is provided in the extension script (ejspreadsheet-custom-print-extension.js). Could you please extend this script and use the below code example to achieve your requirement in sample level? 
 
 
<html> 
<head> 
   //... 
   <script src="Scripts/ejspreadsheet-custom-print-extension.js" type="text/javascript"></script> 
 
<script type="text/javascript"> 
        var defaultData, defaultData1; 
 
        defaultData = [...]; 
        defaultData1 = [...]; 
 
        $(function () { 
            $("#Spreadsheet").ejSpreadsheet({ 
                sheets: [{ 
                    rangeSettings: [{ dataSource: defaultData }, { dataSource: defaultData1, startCell: "J1" }] 
                }], 
                loadComplete: "loadComplete" 
            }); 
        }); 
 
        function loadComplete(args) { 
            //Here extend the ejSpreadsheet.Extension 
            $.extend(this, ej.spreadsheetFeatures.extension); 
 
            if (!this.isImport) { 
                //... 
                this.XLChart.createChart("A1:B6", { type: "column", enable3D: false, marker: false, top: 40, left: 260, width: 340, height: 250 }); 
                this.XLChart.createChart("J1:L6", { type: "column", enable3D: false, marker: false, top: 40, left: 860, width: 340, height: 250 }); 
            } 
        } 
 
        function customPrintFunc() { 
            var ssObj = $("#Spreadsheet").data("ejSpreadsheet"); 
 
            //If the passed cell range contains chart means, it'll automatically print after cell data or else print only cell data. 
            ssObj.customPrintSelection(["A1:C10", "J1:L6", "A10:C13"]); //Here pass the cells ranges that you want to print. 
        } 
 
    </script> 
</head> 
<body> 
     //... 
     <button onclick="customPrintFunc()">Click here to Print</button> 
     <div id="Spreadsheet"></div> 
</body> 
</html> 
 
 
 
Could you please check the above sample and get back to us with more information if your requirement is not fulfilled or need further assistance on this? 
 
Regards, 
Silambarasan 


Loader.
Up arrow icon