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

EPPLus With Classic ASP

Dec 24, 2014 at 2:39 PM
I want to use EPPLus with Classic ASP, like so:


To do this, I need to register the dll. But using regsvr32 fails.

Is this impossible? Can EPPlus only be used with ASP.Net?
Dec 27, 2014 at 9:28 AM

EPPlus does not have a COM interface, so you can not register it using regsvr32 or call it from Classic ASP.
Dec 27, 2014 at 2:10 PM
It turns out to be easy to reference EPPlus in a C# project that serves as a COM wrapper.

However, perhaps it is wiser to have an ASP Web site that uses a single ASPX (ASP.Net) page to communicate with EPPlus?

Also, if I want to run a script on my Windows 2008 RS server as a scheduled task, is there a way to have that script communicate directly with EPPlus?
Feb 27, 2015 at 2:47 PM
Did you made it working using COM wrapper?
Feb 27, 2015 at 5:05 PM
Yes, I created a C# DLL to be a COM wrapper that I called ExcelReport.

It has two public methods, one for getting data from MS Access and one for SQL Server. I pass it the connection string and the location of a spreadsheet to populate with data. The COM object then e-mails the spreadsheet to a list of people.

I wrote a VB script in which this is the key line:
sAttachment = oExcelReport.Make5SReportSQL(strDest, strSQLConn)
The VB script makes a copy of a template spreadsheet that has formatting and tabs but no data. The location of that copy is passed in to the COM object's method.

A scheduled task calls the VB script using the following command:
C:\Windows\SysWOW64\cscript.exe "Drive:\\My\Script\Location\ScriptName.vbs"
So, to reiterate:
  1. The Windows task scheduler calls cscript. (This addresses 32/64 bit issues.)
  2. Cscript launches the VB script.
  3. The script copies the template, creates the COM object, and then passes the copy location.
  4. The COM object uses EPPlus to put data into the copied template and then uses C# to e-mail the copy as an attachment.