We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Error in Export to Excel

Thread ID:

Created:

Updated:

Platform:

Replies:

119596 Jul 12,2015 06:41 PM Aug 4,2015 05:56 AM JavaScript 4
loading
Tags: ejGrid
Ryan Obbink
Asked On July 12, 2015 06:41 PM

Hi there,

We have an issue where we are getting the following error returned to us from your "Export to Excel" webservice for the grid. 

<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>Type 'System.String' is not supported for deserialization of an array.</ExceptionMessage>
<ExceptionType>System.InvalidOperationException</ExceptionType>
<StackTrace>
at System.Web.Script.Serialization.ObjectConverter.ConvertListToObject(IList list, Type type, JavaScriptSerializer serializer, Boolean throwOnError, IList&amp; convertedList)
at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object&amp; convertedObject)
at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object&amp; convertedObject)
at System.Web.Script.Serialization.ObjectConverter.AssignToPropertyOrField(Object propertyValue, Object o, String memberName, JavaScriptSerializer serializer, Boolean throwOnError)
at System.Web.Script.Serialization.ObjectConverter.ConvertDictionaryToObject(IDictionary`2 dictionary, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object&amp; convertedObject)
at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object&amp; convertedObject)
at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object&amp; convertedObject)
at System.Web.Script.Serialization.ObjectConverter.AddItemToList(IList oldList, IList newList, Type elementType, JavaScriptSerializer serializer, Boolean throwOnError)
at System.Web.Script.Serialization.ObjectConverter.ConvertListToObject(IList list, Type type, JavaScriptSerializer serializer, Boolean throwOnError, IList&amp; convertedList)
at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object&amp; convertedObject)
at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object&amp; convertedObject)
at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToType(Object o, Type type, JavaScriptSerializer serializer)
at Northwind.JSGridExportController.ConvertGridObject(String gridProperty) in f:\Product\BetaExportingServices\Northwind\JSGridExportController.cs:line 72
at Northwind.JSGridExportController.ExcelExport() in f:\Product\BetaExportingServices\Northwind\JSGridExportController.cs:line 30
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.&lt;&gt;c__DisplayClassf.&lt;GetExecutor&gt;b__9(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)
</StackTrace>
</Error>

And here is the form that was sent:

<form action="http://js.syncfusion.com/ExportingServices/api/JSGridExport/PdfExport" method="post"><input name="GridModel" type="hidden" value='{"allowPaging":true,"showColumnChooser":false,"allowSorting":true,"showStackedHeader":false,"selectedRecords":[],"stackedHeaderRows":[],"allowMultipleExporting":false,"allowFiltering":false,"allowSelection":true,"allowGrouping":false,"showSummary":false,"allowResizing":true,"allowResizeToFit":true,"allowTextWrap":false,"allowCellMerging":false,"enablePersistence":false,"selectedRowIndex":-1,"allowSearching":false,"allowReordering":false,"enableTouch":false,"locale":"en-US","allowMultiSorting":false,"exportToExcelAction":"","exportToWordAction":"","exportToPdfAction":"","selectionSettings":{"selectionMode":["row"],"enableToggle":false},"groupSettings":{"showDropArea":true,"showToggleButton":false,"enableDropAreaAnimation":true,"showGroupedColumn":true,"showUngroupButton":true,"enableDropAreaAutoSizing":true,"captionFormat":null,"groupedColumns":[]},"contextMenuSettings":{"enableContextMenu":false,"contextMenuItems":["Add Record","Edit Record","Delete Record","Sort In Ascending Order","Sort In Descending Order","Next Page","Last Page","Previous Page","First Page","Save","Cancel","Grouping","Ungrouping"],"customContextMenuItems":[]},"filterSettings":{"filterType":"filterbar","filterBarMode":"immediate","showFilterBarStatus":true,"statusBarWidth":450,"showPredicate":false,"filteredColumns":[],"maxFilterChoices":1000,"enableCaseSensitivity":false},"sortSettings":{"sortedColumns":[]},"toolbarSettings":{"showToolbar":true,"toolbarItems":["excelExport","wordExport","pdfExport"],"customToolbarItems":[]},"minWidth":0,"scrollSettings":{"width":1168,"height":500,"enableTouchScroll":true,"allowVirtualScrolling":false,"virtualScrollMode":"normal","frozenRows":0,"frozenColumns":0},"summaryRows":[],"childGrid":null,"mergeCellInfo":null,"create":null,"actionBegin":null,"actionComplete":null,"actionFailure":null,"beginEdit":null,"endEdit":null,"endAdd":null,"endDelete":null,"beforeBatchAdd":null,"beforeBatchSave":null,"beforeBatchDelete":null,"batchAdd":null,"batchDelete":null,"cellSave":null,"cellEdit":null,"resizeStart":null,"resizeEnd":null,"resized":null,"load":null,"destroy":null,"rowSelecting":null,"rowSelected":null,"cellSelecting":null,"cellSelected":null,"columnSelecting":null,"columnSelected":null,"columnDragStart":null,"columnDrag":null,"columnDrop":null,"dataBound":null,"recordClick":null,"recordDoubleClick":null,"rightClick":null,"detailsCollapse":null,"detailsExpand":null,"contextOpen":null,"contextClick":null,"columns":[{"headerText":"Manage","commands":[{"type":"edit","buttonOptions":{"text":"Edit","width":"50","click":"onGridRecordEdit"}},{"type":"delete","buttonOptions":{"text":"Delete","width":"50","click":"onGridRecordDelete"}}],"isUnbound":true,"textAlign":"center","width":36,"visible":true,"field":"","type":null,"allowSorting":false,"allowFiltering":false,"allowGrouping":false},{"field":"ID","isPrimaryKey":true,"headerText":["#"],"textAlign":"right","width":8,"visible":false,"type":"object"},{"field":"ElementID","isPrimaryKey":false,"headerText":["Entry ID"],"textAlign":"left","width":20,"visible":false,"type":"object"},{"field":"UserHashKey","isPrimaryKey":false,"headerText":["User Hash Key"],"textAlign":"left","width":20,"visible":false,"type":"object"},{"field":"Name191","isPrimaryKey":false,"headerText":["Name"],"textAlign":"left","width":100,"visible":true,"type":"object"},{"field":"Type193","isPrimaryKey":false,"headerText":["Type"],"textAlign":"center","width":18,"visible":true,"type":"object"},{"field":"Order192","isPrimaryKey":false,"headerText":["Order"],"textAlign":"center","width":40,"visible":true,"type":"object"}],"isResponsive":false,"enableResponsiveRow":false,"commonWidth":200,"keyConfigs":{"focus":"e","insertRecord":"45","deleteRecord":"46","editRecord":"113","saveRequest":"13","cancelRequest":"27","nextPage":"34","previousPage":"33","lastPage":"ctrl+alt+34","firstPage":"ctrl+alt+33","nextPager":"alt+34","previousPager":"alt+33","firstCellSelection":"36","lastCellSelection":"35","firstRowSelection":"ctrl+36","lastRowSelection":"ctrl+35","upArrow":"38","downArrow":"40","rightArrow":"39","leftArrow":"37","moveCellRight":"9","moveCellLeft":"shift+9","selectedGroupExpand":"alt+40","totalGroupExpand":"ctrl+40","selectedGroupCollapse":"alt+38","totalGroupCollapse":"ctrl+38"}}'></form>



Ryan Obbink
Replied On July 12, 2015 06:46 PM

To further explain, we are using the following ejGrid control.  We are currently at Syncfusion version: 13.1.0.21.

var $data = ej.DataManager($gridData).executeLocal(ej.Query().take(50));
    $("#grid").ejGrid({
        dataSource: $data,
        allowPaging: true,
        allowScrolling: true,
        allowSorting: true,
        allowResizing: true,
        allowResizeToFit: true,
        commonWidth: 200,
        columns: $columns,
        enableRowHover: true,
        enableTouch: false,
        pageSettings: { pageSize: 25 },
        scrollSettings: { width: "100%", height: 500 },
        toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.ExcelExport, ej.Grid.ToolBarItems.WordExport, ej.Grid.ToolBarItems.PdfExport] },
        toolbarClick: function (e) {
            this.exportGrid = this["export"];
            if (e.itemName == "Excel Export") {
                this.exportGrid('http://js.syncfusion.com/ExportingServices/api/JSGridExport/ExcelExport')
                e.cancel = true;
            }
            else if (e.itemName == "Word Export") {
                this.exportGrid('http://js.syncfusion.com/ExportingServices/api/JSGridExport/WordExport')
                e.cancel = true;
            }
            else if (e.itemName == "PDF Export") {
                this.exportGrid('http://js.syncfusion.com/ExportingServices/api/JSGridExport/PdfExport')
                e.cancel = true;
            }
        }
    });



Alan Sangeeth S [Syncfusion]
Replied On July 13, 2015 08:56 AM

Hi Ryan,

Thanks for using Syncfusion products.

We have analyzed your code snippet and the found that you have used below Online WebService for exporting Grid. The below online WebAPI service is specifically created for JS Grid Exporting demo sample in Online JS Sample Browser and it cannot be used for any other sample.
http://js.syncfusion.com/ExportingServices/api/JSGridExport/ExcelExport

We  need to create a service for exporting based on the Grid Exporting sample and we have already created a KB on this. Please refer the following KB link.
http://www.syncfusion.com/kb/4487/how-to-export-grid-to-word-excel-and-pdf-in-javascript

Please let us know if you need any further assistance.

Regards,
Alan Sangeeth S

Ryan Obbink
Replied On August 1, 2015 07:44 PM

Hi Ryan,

Thanks for using Syncfusion products.

We have analyzed your code snippet and the found that you have used below Online WebService for exporting Grid. The below online WebAPI service is specifically created for JS Grid Exporting demo sample in Online JS Sample Browser and it cannot be used for any other sample.
http://js.syncfusion.com/ExportingServices/api/JSGridExport/ExcelExport

We  need to create a service for exporting based on the Grid Exporting sample and we have already created a KB on this. Please refer the following KB link.
http://www.syncfusion.com/kb/4487/how-to-export-grid-to-word-excel-and-pdf-in-javascript

Please let us know if you need any further assistance.

Regards,
Alan Sangeeth S

Hi Alan,

So I have made the decision to use the example to light up the pdf, excel, and word exporters.  Only issue I am having right now is trouble finding the right .dll references to include to the project and what usings to use after.


Let me know.

Thanks.

-Ryan Obbink

Madhu Sudhanan P [Syncfusion]
Replied On August 4, 2015 05:56 AM

Hi Ryan,

Sorry for the delay in getting back to you. Please find the response.

Query: “Only issue I am having right now is trouble finding the right DLL references to include to the project and what using to use after”

Please refer the below list of DLLs required to perform export operation in JS Grid.

1. Syncfusion.EJ
2. Syncfusion.EJ.Export
3. Syncfusion.Core
4. Syncfusion.Compression.Base
5. Syncfusion.Linq.Base
6. Syncfusion.DocIo.Base
7. Syncfusion.XlsIo.Base
8. Syncfusion.Pdf.Base

And also please refer the below link for using Export feature in Grid.

http://www.syncfusion.com/kb/javascript/ejgrid?sortId=0&tags=export

http://www.syncfusion.com/kb/aspnetmvc/grid?sortId=0&tags=exporting

http://www.syncfusion.com/kb/aspnet/grid?sortId=0&tags=export

Please let us know if you have any queries.

Regards,
Madhu Sudhanan. P

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;