This is a migrated thread and some comments may be shown as answers.

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

4 Answers 265 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Morten
Top achievements
Rank 1
Iron
Veteran
Iron
Morten asked on 01 Apr 2017, 11:30 AM

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

 

 

4 Answers, 1 is accepted

Sort by
0
Morten
Top achievements
Rank 1
Iron
Veteran
Iron
answered on 01 Apr 2017, 11:59 AM

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

 

0
Nencho
Telerik team
answered on 04 Apr 2017, 07:25 AM
Hello Morten,

Yes, the referenced 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.
0
Morten
Top achievements
Rank 1
Iron
Veteran
Iron
answered on 04 Apr 2017, 08:35 AM

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

0
Nencho
Telerik team
answered on 05 Apr 2017, 06:28 AM
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.
Tags
Spreadsheet
Asked by
Morten
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Morten
Top achievements
Rank 1
Iron
Veteran
Iron
Nencho
Telerik team
Share this question
or