Last post Nov 25, 2009 07:19 AM by markp11
Nov 24, 2009 10:28 AM|markp11|LINK
I have a requirement to be able to export data to an Excel spreadsheet (created on the fly) from an ASP.net application. I am attempting to use OpenOfficeXML 2.0 as this appears to be the way to go?
I have downloaded and installed the components from Microsofts site and set a reference in my Web Project to the DocumentFormat.OpenXML.dll, and as such in my classes I can see and reference all the objects associated with the DLL.
My application builds ok with no reported errors, however on running the application the browser opens and then shows the following:
Compiler Error Message: BC30002: Type 'SpreadsheetDocument' is not defined.
Line 34: Public Sub NewSpreadsheet()
Line 36: Dim sprdsheet As SpreadsheetDocument = SpreadsheetDocument.Create(FileName, SpreadsheetDocumentType.Workbook)
Line 37: Dim WrkBookPart As WorkbookPart = sprdsheet.AddWorkbookPart
Line 38: Dim wrkbook As New Workbook
At the start of my class I import the following:
Public Class clsExcel
Public Sub NewSpreadsheet()
I am not sure what I am doing wrong / missing and the usual searching of the web is turning up nothing. Could someone please help?
NB. I do not currently have Office 2007 installed on my PC so I am not sure if this is a pre-requisite for running OpenOfficeXML, my assumption is that it is not ?
Nov 25, 2009 07:19 AM|markp11|LINK
Problem solved, the issue was purely down to having created an App_Code folder inside of the project, into which all of my code was placed, and up until I started trying to use the Open XML everything was working fine. To solve the problem I moved all of
my code to the AppData folder and everything now works.