Having some Issue to open excel sheet with SpreadsheetGear

Posted by: grapecity.com on 23 August 2018, 10:35 pm EST

  • Posted 23 August 2018, 10:35 pm EST

    Hello,

    I need help to fix the issue "Corrupt xml document" that I am getting during open the excel sheet with SpreadsheetGear.

    What I am doing :

    First i am loading the sheet client side :
    function ImportInputFile(filePath) {
    var excelUrl = filePath;
    var oReq = new XMLHttpRequest();
    oReq.open('get', excelUrl, true);
    oReq.responseType = 'blob';
    oReq.onload = function () {
    var blob = oReq.response;
    inputExcelIO.open(blob, LoadInputSpread, function (message) {
    //here is my some other code
    });
    };
    oReq.send(null);
    }

    Everything is working fine.

    2. Now I am doing some changes in the file and trying to access the updated file server side as :
    //* ExcelFilePath - Its the file that I have used client side to load.
    var fileCollection = Request.Files;
    var fileName = fileCollection[0];
    var filePath = Server.MapPath(ExcelFilePath);

    //Creating temprary folder path to save file with new name.
    string tempFilePath = Guid.NewGuid().ToString() + FileExtension;
    tempFilePath = TempPath + "/" + tempFilePath;
    fileName.SaveAs(tempFilePath);

    The functionality is still working fine as I can save the updated file with new name in directory.

    Now, I have to implement some more functionality and need to access the same file (Old one) and for the same I have applied the code to open the file with spreadsheetgear as :
    SpreadsheetGear.IWorkbook workbookInput = SpreadsheetGear.Factory.GetWorkbook(filePath); //Used same file on client side also.

    The spreadsheetgear method throwing the exception as "corrupt xml document".
    I have tried to open the any other file instead of the file that I have used already then its working fine. It seems its not working because I am trying to access the file that is already in use (client side) but still I need to open this file but I don't know how it will be possible.

    Please provide me the best solution to fix this issue, appreciated.
  • Marked as Answer

    Replied 27 August 2018, 4:16 pm EST

    Hello,

    You are using SpreadsheetGear and not GrapeCity Spread.
    Please contact SpreadsheetGear support on their forums.

    Thanks,
    Deepak Sharma
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels