This project has moved and is read-only. For the latest updates, please go here.

How do I install and use it ?

Dec 30, 2011 at 1:22 PM

My project is in ASP.NET and I am using VB script. I do not have visual studio installed.

Can you tell me where to find the instructions for installing ClosedXML in .NET ?

Thanks

Dec 31, 2011 at 12:47 AM

You must be using classic ASP and not ASP.NET. In such case you can treat ClosedXML like you would treat any other .NET library.

Jan 2, 2012 at 5:17 PM

Message body

Dear MDeLeon,
 
I am using ASP.NET but coding directly without visual studio. I am using Framework 4
 
I tried copying the files to C:\Windows\Microsoft.NET\assembly\GAC_32\ClosedXML folder and specified
in my code.
 
  IMPORTS ClosedXML
....
 dim Workbook as xlworkbook = new XLWorkbook()
dim worksheet = workbook.Worksheets.Add("Sample Sheet")
worksheet.Cell("A1").Value = "Hello World!"
workbook.SaveAs(Server.MapPath("backups/HelloWorld.xlsx"))
....
There was no error on the 'IMPORTS' line but the compiler error is :
 
Compiler Error Message: BC30002: Type 'xlworkbook' is not defined.

Source Error:

 
 
Line 314:	Protected Sub ClosedXML (ByVal sender As Object, _
Line 315:                          ByVal e As System.EventArgs)
Line 316:			dim Workbook as xlworkbook = new XLWorkbook()
Line 317:            dim worksheet = workbook.Worksheets.Add("Sample Sheet")
Line 318:            worksheet.Cell("A1").Value = "Hello World!"
 
Apparently the system simply ignores any IMPORTS it cannot locate.
 
I want to know for using ClosedXML, where do I copy the extracted files. Also is DocumentFormat...DLL required to be installed and if so how do I install it ?
Thanks for the help
 
Jan 2, 2012 at 5:33 PM

You don't need to "install" or register the DLLs. Just copy ClosedXML.dll and DocumentFormat.OpenXml.dll to your /bin folder and use:

Imports ClosedXML.Excel


You shouldn't have to do anything else but just in case ASP.NET is being stubborn you could also add it to the config file:

<Configuration>
  <System.Web>
    <Compilation>
      <Assemblies>
        <Add Assembly="ClosedXML" />
        <Add Assembly="DocumentFormat.OpenXml" />
      </Assemblies>
    </Compilation>
  </System.Web>    
</Configuration>
 
Jan 3, 2012 at 6:52 PM

Dear MDeLeon

Thanks for the help. It worked great.

Regards