jmesolomon
jmesolomon

Reputation: 563

Coldfusion OpenXml Error: Could not load file or assembly 'DocumentFormat.OpenXml'

I am .net coder and I am really really new to ColdFusion. I wrote a .dll library which automatically generates an invoice. I needed to use the library from a ColdFusion application. I have successfully loaded the classes in my library as coldfusion objects as I can call the methods. However, there is one method in my class which uses WordprocessingDocument which is a class of DocumentFormat.OpenXml.Packaging. I am actually getting this error :

System.IO.FileNotFoundException: Could not 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. File name: 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at InvoiceLibrary.DocumentHandler.ConvertDocumentToDOCX(String file)
at InvoiceLibrary.DocumentHandler.ProcessDocument()

I have imported the DocumentFormat.OpenXml.dll so is the WindowsBase.dll files

<cfObject type=".NET" name="WordprocessingDocument"
     class="DocumentFormat.OpenXml.Packaging.WordprocessingDocument" 
     assembly="C:\Users\mydocs\Documents\Visual Studio 2012\Projects\InvoiceGenerator\InvoiceLibrary\bin\Release\DocumentFormat.OpenXml.dll,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\WindowsBase.dll">

I need your guidance to what am I doing wrong or what am I missing here?

Upvotes: 10

Views: 7122

Answers (1)

Brian from state farm
Brian from state farm

Reputation: 2896

Use a tool like dependency walker to make sure you are copying all of the required linked dlls that DocumentFormat.OpenXml.dll is using. Also do not forget to copy this file with your output.

Upvotes: 0

Related Questions