Export files using only data on server side

Hi.
Is it possible to implement a server side feature that will export PivotGrid view to Excel/PDF/Word files based on the same datasource that angular control (ej-pivotgrid) is?
I mean this structure:
        $scope.datasource = {
            data: [],
            values: [],
            rows: [],
            columns: []
        };
If yes can you direct me in the right way?

Our need is to periodicaly generate such reports based on their datasource configuration without the use of the html views.
Thanks


3 Replies

MM Manikandan Murugesan Syncfusion Team November 23, 2017 05:30 PM UTC

Hi Support, 
 
We are unable to understand the exact requirement from your query. Kindly provide more details about your requirement with screenshots/video (if possible) which would be helpful for us to proceed further. 
 
Note: We don’t have exporting support if your requirement is exporting PivotGrid by using only data source without rendering the control. 
 
Thanks, 
Manikandan. 



TM Tailored Mobile Solutions Sp. z o.o. November 30, 2017 10:41 AM UTC

Hello.
Thank you for your answer.
To clarify my first query: I would like to "render" the final view of the PivotGrid in memory, without any user interaction, based on the datasource, using C# libraries. Then instead of sending it to the browser, send it to xlsx file.
My question is: is it possible and if yes, what library can I use to render this PivotGrid based on the datasource.
To clarify even more: we already use Syncfusion.JavaScript.Olap.OlapClient.ExportOlapClient method but it uses OlapDataManager to render Olap views based on report definition. Then we get rendered view by webservice and convert it to file. Now we just need to render some PivotGrids, but can't find suitable class to do it.
Thanks


MM Manikandan Murugesan Syncfusion Team December 1, 2017 01:13 PM UTC

Hi Support, 

Yes. You can export PivotGrid without rendering it, if you are using OLAP (Server Mode). We have prepared sample as per your requirement. Please find the sample in below link. 

In the sample, by using AJAX post we have passed serialized report to controller. You must need to pass below information to the ExportPivotGrid method from controller. Please refer below code snippet. 

Code Snippet: [javascript] 
<script type="text/javascript"> 
                $(function() 
                { 
                    params = { "args": "{\"exportOption\":\"excel\",\"fileFormat\":\".xls\",\"currentReport\":\"H4sIAAAAAAAEAO1ZTW/bOBC9L7D/wfB9o6TBXlpFhWPHabBpG9hu0qDogZGnNmFa9JKUHffXdyhSMklRabubXhZ7i2beI2fI+aKTvn5cs94WhKS8OOufHB33X2e//5a+Z2QzgQ0XqoeAQr58lPSsv1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dY0b8ik7BLQefXWLRlpkSpr6xD65Bv9YSQx6ltnW0jrTaQakirMTDGd1NgWAF0MbUeBFKLHQuAr/AGiJ7GjAWeyLVYJ+sQGJtxzhTduAaHKveUqoVcZR3XUaXDDKcpDZn5/C5I0x3wAMmel3qgwFGC6f7QiNzjmoCkX2HCd9I7L0fcRpumFCPUGss5rDLjY6pqQij20HYJozEnHVG454xdUTBarLzzbYQmglrhkg5LIbBdDssHM5AN5lv8xBGpd8fFSmLQBQDD4kVhAgmrGS6W6UmiN+WlyOHs6FXvqsBGTlgPBx/C+OIsWLU3unuFK4eLVEubASr2PnZ79k+NX5El3Uk3Ne3v557kunZkhohXrz+e572OBwnfe6sbzD98p4+pzHUifO9tXuN+8XvcbNO7BxL7iaLTLkv4773L9d3i08l4+f873L6y62D8lW/vf/XCi5SQqipfrDdqb0q2LpFubQ5VPgfbQpRQyyv0Bwl3SxAwZKSUgPPPlNFcV1LTMDrVptByLNZxvd30CcTBWDv6uvPLQdbAhoTlpR5J5zaBxoKvdU9xaN0Yswxu/cyNIbJkOuMLfN3c0C1vGrUrMu0vtPRZrImvmt5SoUrC/trQZ/W9Y9n0hiwQu9FtudnI+f1Cq6c4hmR/Hnu/azTyNsVOEBqRnXgkV1OPMlUiebsEIg8YrN0WGmdbTpkCBHM9ejZuUu+HuBW49S+VZkYxCWvm1jSRh8HFlBCXlFY/VKDQ+cECpduqBKF46/7okjib/5Ahk3p6/jVW2NLunpDNwAk+/8GElCmyaXL4X0r2DRunedFvGQAA\",\"layout\":\"normal\",\"colorSettings\":\"{\\\"rowCellColor\\\":\\\"rgb(51, 51, 51)\\\",\\\"rowCellBGColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"columnCellColor\\\":\\\"rgb(51, 51, 51)\\\",\\\"columnCellBGColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"valueCellColor\\\":\\\"rgb(51, 51, 51)\\\",\\\"valueCellBGColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"summaryCellColor\\\":\\\"rgb(51, 51, 51)\\\",\\\"summaryCellBGColor\\\":\\\"rgba(255, 255, 255, 255)\\\"}\",\"customObject\":\"{}\",\"title\":\"\",\"description\":\"\"}" }; 
                    url = "/Olap/Export"; 
                    var form = $('<form>').attr({ 'action': url, 'method': 'POST', 'name': 'export' }); 
                    var addParam = function (paramName, paramValue) { 
                        var input = $('<input type="hidden" title="params">').attr({ 
                            'id': paramName, 
                            'name': paramName, 
                            'value': paramValue 
                        }).appendTo(form); 
                    }; 
                    for (var item in params) 
                        addParam(item, params[item]); 
                    form.appendTo(document.body).submit().remove(); 
                }); 
        </script> 

Code Snippet: [C#] 
        [System.Web.Http.ActionName("Export")] 
        [System.Web.Http.HttpPost] 
        public void Export() 
        { 
            string args = HttpContext.Current.Request.Form.GetValues(0)[0]; 
            OlapDataManager DataManager = new OlapDataManager(connectionString); 
            string fileName = "Sample"; 
            htmlHelper.ExportPivotGrid(DataManager, args, fileName, System.Web.HttpContext.Current.Response); 
        } 

Please let us know if you have any queries. 

Note: We don’t have exporting support if your requirement is exporting PivotGrid by using only data source without rendering the control in OLAP (Client Mode). 
 
Thanks, 
Manikandan. 


Loader.
Up arrow icon