Upload in asp.net mvc (asking for Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml)

5 posts, 0 answers
  1. Morten
    Morten avatar
    349 posts
    Member since:
    Jul 2012

    Posted 01 Apr 2017 Link to this post

    I have referenced Telerik.Web.Spreadsheet.dll and want to import an uploaded xslx to a spreadsheet in a asp.net mvc view.

    I'm following this demo: http://demos.telerik.com/aspnet-mvc/spreadsheet/server-side-import-export

    My code:

            [HttpPost]
            public ActionResult Upload(HttpPostedFileBase file)
            {
                var workbook = Telerik.Web.Spreadsheet.Workbook.Load(file.InputStream, Path.GetExtension(file.FileName));
                return Content(workbook.ToJson(), Telerik.Web.Spreadsheet.MimeTypes.JSON);
            }

     

    The line " var workbook = Telerik.Web.Spreadsheet.Workbook.Load(file.InputStream, Path.GetExtension(file.FileName));" throws the following error:

    InnerException    {"Could not load file or assembly 'Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml, Version=2017.1.109.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. The system cannot find the file specified.":"Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml, Version=2017.1.109.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7"}    System.Exception {System.IO.FileNotFoundException}

     

    then I add Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.dll and get a similar exception for Telerik.Windows.Documents.Core.dll.

    then I add Telerik.Windows.Documents.Core.dll and get a new exception type:

    ($exception).InnerException    {"Could not load file or assembly 'Telerik.Windows.Documents.Core, Version=2017.1.109.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Telerik.Windows.Documents.Core, Version=2017.1.109.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7"}    System.Exception {System.IO.FileLoadException}

     

    What dll's must I reference (and how) in a asp.net mvc project?

    /Morten

     

     

  2. Morten
    Morten avatar
    349 posts
    Member since:
    Jul 2012

    Posted 01 Apr 2017 in reply to Morten Link to this post

    I think I figured it out.

    Is it correct that for a web project I need to ref the following dlls:

    Telerik.Web.Spreadsheet.dll

    Telerik.Windows.Documents.Core.dll

    Telerik.Windows.Documents.Spreadsheet.dll

    Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.dll

    Telerik.Windows.Zip.dll

     

  3. Nencho
    Admin
    Nencho avatar
    1871 posts

    Posted 04 Apr 2017 Link to this post

    Hello Morten,

    Yes, the referenced dlls are needed for the usage of the Spreadsheet in your project. In addition, this is described and referenced in the Dependencies documentation article of the Spreadsheet:

    http://docs.telerik.com/aspnet-mvc/helpers/spreadsheet/spreadsheet-processing#dependencies


    Regards,
    Nencho
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  4. Morten
    Morten avatar
    349 posts
    Member since:
    Jul 2012

    Posted 04 Apr 2017 in reply to Nencho Link to this post

    Thanks for your confirmation Nencho.

    I just found it counter intuitive to have to include references to Windows assemblies in a web project.

    Also, I think the documentation provided in http://docs.telerik.com/aspnet-mvc/helpers/spreadsheet/spreadsheet-processing#dependencies could be more precise. For instance, it never mentions anything abound any other assembly than Telerik.Web.Spreadsheet.dll

    Anyway, I figured it out. Thanks. :-)

    /Morten

  5. Nencho
    Admin
    Nencho avatar
    1871 posts

    Posted 05 Apr 2017 Link to this post

    Hello Morten,

    Indeed the referenced article could be modified, in order to specify the exact dll that needs to be referenced. We will enhance the article in question.

    Regards,
    Nencho
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top