Error trying to create Excel table with Closedxml

Asked

Viewed 648 times

1

I’m trying to create an application that generates an Excel spreadsheet through Visual Studio 2015 using Closedxml as a reference. As I found some examples on the web, I added it to the code (using Closedxml.Excel;), downloaded the reference and added it to the project and tried to create a simple spreadsheet, as shown as an example on the Closedxml website itself (https://github.com/ClosedXML/ClosedXML).

I added the code below, but when running the program appears the error:

An unhandled Exception of type 'System.IO.Filenotfoundexception' occurred in System.Windows.Forms.dll Additional information: It was not can load file or Assembly 'Documentformat.Openxml, Version=2.5.5631.0, Culture=neutral, Publickeytoken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

var workbook = new XLWorkbook();
var worksheet = workbook.Worksheets.Add("Sample Sheet");
worksheet.Cell("A1").Value = "Hello World!";
workbook.SaveAs("HelloWorld.xlsx");

You need to configure something else in Visual Studio?

1 answer

0


You’re missing some dependencies on your project, install the library via nuget with the following command:

Install-Package DocumentFormat.OpenXml
  • Hello, Carlos Eduardo! Really that was it! I installed the library via nuget and it worked. Thank you very much! Abs!!!

  • Good Leandro, if you need us we are there !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.