Error trying to create Excel table with ClosedXML

1

I'm trying to create an application that generates a spreadsheet in Excel through Visual Studio 2015 using ClosedXML as a reference. As I found some examples on the web, I added the same to the code (using ClosedXML.Excel;), I downloaded the reference and added it to the project and tried to create a simple spreadsheet, as shown as an example in the ClosedXml site itself ( link ).

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

  An unhandled exception of type 'System.IO.FileNotFoundException'   occurred in System.Windows.Forms.dll Additional information:   possible to load file or assembly 'DocumentFormat.OpenXml,   Version = 2.5.5631.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 '   or one of its dependencies. The system can not 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");

Do I need to setup anything else in Visual Studio?

    
asked by anonymous 04.03.2016 / 19:33

1 answer

0

You are missing some dependencies in your project, install the library via nuget with the following command:

Install-Package DocumentFormat.OpenXml
    
05.03.2016 / 21:01