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.

Spreadsheet issues/questions

Thread ID:

Created:

Updated:

Platform:

Replies:

125604 Aug 27,2016 04:55 AM Aug 30,2016 08:02 AM JavaScript 4
loading
Tags: ejSpreadSheet
Gabriel Axel
Asked On August 27, 2016 04:55 AM

Greetings,

  • I'm trying to save the spreadsheet content to the server without downloading it. The export functionality does the saving part fine, but I don't want it to invoke download. I saw there is a saveAsJSON method, but is it possible to convert its output to something that can be converted to XLSX on the server?

  • When trying to import XLSX files that contain images, the operation fails with "Unsupported file" message. Is there a way to overcome this? Is it in the roadmap?
Thanks.

Gabriel Axel
Replied On August 27, 2016 11:53 AM

Update: not every XLSX with images fails to import. A spreadsheet created in Excel was imported successfully, but a spreadsheet created and exported from Google Drive did not. I'm attaching the problematic spreadsheet.

Attachment: testpic.xlsx_ab4a9b81.zip

Gabriel Axel
Replied On August 27, 2016 01:07 PM

A few more thing:
  • If the spreadsheet from Excel contains shapes, they disappear on import.
  • Charts and images look alright on import, but on export they sometimes move or get resized, even without any user modification in the component UI.
Attached a spreadsheet where both issues can be reproduced.

About the export without download issue from the first message, I resolved it using the XLExport.getExportProps() method - it returns an object that contains "data" and "model", which I send to the Spreadsheet.save() method on the server which generates the XLSX file. The question is whether XLExport.getExportProps() is considered part of the public API, as I didn't see it in the docs. If not, I suggest adding it or any stable alternative as part of the public API.

Thanks.

Attachment: exceltest_4162dbcf.zip

Gabriel Axel
Replied On August 28, 2016 04:32 PM

I would like to propose making the image importing feature pure client side (or at least optional based on configuration) to save an unnecessary HTTP call to the server. I was able to implement this by reading the selected file from the input using FileReader and getting it as data URL, which I used with the XLShape.setPicture() method. Here is the listener for the file input's change event:

const onChange = event => {
  if(event.target.files.length === 0) {
    return
  }
  const file = event.target.files[0]
  const reader = new FileReader()
  reader.onload = event => {
    const src = event.target.result
    const spreadsheet = $('#spreadsheet').data('ejSpreadsheet')
    const cell = spreadsheet.getActiveCell() || {rowIndex: 0, colIndex: 0}
    spreadsheet.XLShape.setPicture([cell.rowIndex, cell.colIndex], src)
  }
  reader.readAsDataURL(file)
  event.target.value = ''
}

It would have been nice to have this out of the box, or at least make it possible to customize the functionality of the "Picture" button in the default ribbon - I needed to write a pretty weird piece of code to replace the original "Picture" button in the ribbon with one that implements the functionality above.

Thanks.

Shanmugaraja K [Syncfusion]
Replied On August 30, 2016 08:02 AM

Hi Gabrial,  
 
Thanks for using Syncfusion products.  
  
Query 1: XLExport.getExportProps() is considered part of the public API, as I didn't see it in the docs.  
  
 You can use getExportProps()  public method for your requirement and we will update our UG Document with this public method.   
  
Query 2: If the spreadsheet from Excel contains shapes, they disappear on import.   
  
Currently we don’t have support for this requirement. However, we have added it to our feature request list [“Import with shapes support in ejSpreadsheet”], and it can be tracked through our feature management system. 
  
Query 3: To replace the original "Picture" button in the ribbon  
   
We suggest you to use “ribbonClick” client side event to achieve your requirement. In this event we suggest to set args.cancel as false to prevent default action. Please refer the below code examples.  
 
[JS]  
  
 
        $(function () {  
            $("#Spreadsheet").ejSpreadsheet({  
                ..//  
                ribbonClick: "ribbonclick"  
            });  
        });  
        function ribbonclick(args) {  
            if (args.Id && args.Id.indexOf('Pictures') > -1) { // checking whether the clicked button is picture or not.  
                args.cancel = true; // Prevent default action.  
                // Your code here.  
            }  
        }  
  
 
We have created simple sample with this requirement and the same can be downloaded from the below link. If we misunderstood your requirement, please get back to us with more information.  
 
   
Query 4: When trying to import XLSX files that contain images, the operation fails with "Unsupported file" message.   
Query 5: Charts and images look alright on import, but on export they sometimes move or get resized, even without any user modification in the component UI.  
            
We have considered this ‘“UnSupported file” message while importing excel file with XLSX file ‘and ‘Exported chart gets moved or get resized even without any user modification in the component UI’ as an issue and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.  
 
 
Regards,  
Shanmugaraja K  
  


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.

;