Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include the reference of DocumentFormat.OpenXml.dll on Mono2.10?

I am using C#.net Windows Desktop Application.I want to run these application with other platform also. So, i am using Mono 2.10 as a cross compiler.While running,unexpectedly my Application is terminated by saying the error message like

Error:Could not open the selected folder.
Could not load a file or assembly 'DocumentFormat.OpenXml.dll,version=2.0.5022.0, culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.

I don't know what is problem here...I have installed openxml sdk2.0 on c:\program files\open xml sdk\v2\lib\DocumentFormat.OpenXml.dll.

and also put my application eXe on on the same place for testing purpose...

Please guide me to solve this issue...

like image 537
Saravanan Avatar asked Mar 10 '11 10:03

Saravanan


People also ask

How do I add DocumentFormat OpenXML reference?

Go to your Solution Explorer > right click on references and then click Manage NuGet Packages . Then search in tab "Online" for DocumentFormat. OpenXml and install it.

What is DocumentFormat OpenXML?

The Open XML SDK provides tools for working with Office Word, Excel, and PowerPoint documents. It supports scenarios such as: - High-performance generation of word-processing documents, spreadsheets, and presentations. - Populating content in Word files from an XML data source.

Does OpenXML require office?

No. You only need to have a reference to the library that provides all the OpenXML functionality. That library is not dependant on Office.


3 Answers

Being new to this myself, here's what I did:

I'm using MS Visual Studio 2010 Pro.

  1. Download and install the OpenXML SDK
  2. Within my project in Visual Studio, select "Project" then "Add Reference"
  3. Select the "Browse" tab
  4. In the "Look in:" pull down, navigate to: C:\Program Files(x86)\Open XML SDK\V2.0\lib and select the "DocumentFormat.OpenXml.dll
  5. Hit OK
  6. In the "Solution Explorer" (on the right for me), the "References" folder now shows the DocumentFormat.OpenXML library.
  7. Right-click on it and select Properties
  8. In the Properties panel, change "Copy Local" to "True".

You should be off and running now using the DocumentFormat classes.

like image 179
Imp1ety Avatar answered Oct 12 '22 09:10

Imp1ety


You should also ensure you set a reference to WindowsBase. This is required to use the SDK as it handles System.IO.Packaging (which is used for unzipping and opening the compressed .docx/.xlsx/.pptx as an OPC document).

like image 28
Todd Main Avatar answered Oct 12 '22 09:10

Todd Main


select DocumentFormat.OpenXml under references , view it's properties, and set the Copy Local option to True so that it copies it to the output folder. That worked for me.

like image 25
Som Avatar answered Oct 12 '22 09:10

Som