views:

260

answers:

4

We're currently using a thing from SoftArtisans to generate Excel spreadsheets from data the mainframe FTPs down to our document server.

The doc server has the .Net frameworks through 3.5 on it, as does my development box. The difference is my machine has Office 2007 as well.

So, I built a service this morning with a filewatcher using Interop.Excel to make the spreadsheets without the need for the SoftArtisans piece.

When I install and run on the document server, the app chokes when I drop a file in for conversion, saying "Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=12.0.0.0"

Is there no redistributable package or something I can use? Management doesn't want Office installed on the server.

+2  A: 

As far as I know, the only way to use the Office Interop assemblies, is to have full office client installed on the server.

Nate Bross
+1  A: 

Nate's answer is correct, in order to use Office's PIAs you need to have the Office package installed. Those PIAs will call the Excel executable (in this case) everytime you ask for an Excel.Application object.

There is more information here, and a workaround to Excel's XML format. That may help you.

wtaniguchi
Thanks man. Great library.
aape
+1  A: 

SpreadsheetGear for .NET can create / modify Excel workbooks, and also comes with a Windows Forms Spreadsheet Control which can display your Excel workbooks / charts / etc... You can deploy SpreadsheetGear royalty free and it only requires .NET 2.0. There is no dependency on Excel or anything else besides .NET.

You can learn about the SpreadsheetGear WinForms control here and download the free trial here.

Disclaimer: I own SpreadsheetGear LLC

Joe Erickson
+1  A: 

I work for SoftArtisans; can I ask what prompted you to move away from ExcelWriter? It sounds like your situation is a good fit for our ExcelTemplate product, which supports both binary Excel files and the OOXML ones you'd create with the Office interop assemblies.

Sean Kermes
Hey there. I did end up using SoftArtisans. I'm not sure of the overall OfficeWriter package we have, but according to the License Manager piece, we have ExcelWriter v6, and WordWriter v3. We have a maintenance contract that includes upgrades. Several things came together to create a problem - it has to be in prod before legislative session starts on 03.02, all the services live on two machines, and they said the sheets might be > 65K rows. So it was looking like I'd have to upgrade to the newest version of ExcelWriter so I could break the row limit of the version we run now - continued
aape
and according to what I read, we couldn't run an old version and new on the same machine, so I'd have to upgrade all the services. My bosses like everything tested before we go to prod, even library upgrades, so that was going to be a problem timewise. I then, though, went to the mainframe people, and we talked and they said the source data would not be over 65K rows, so I just wrote it using the version we have. I had a hard time finding good code samples, so the code I wrote ended up being pretty hacky, but it works. The thing that drove me up the wall was that I couldn't figure out how
aape
to define the datatype of a cell (so I could get style.numberformat to apply) when I was just writing to it directly, so I ended up doing a mix of row by row, cell by cell writing (sheet.Cells(row, col).Value = someString) in a loop, and then some by building a datatable with the money cols set to Double, and then doing a sheet.importData(dt, ...)All in all it wasn't bad, but it was frustrating starting from zero with this and being in a rush right out of the gate. We'll be upgrading once session ends, and I'll be able to learn the product and do a rewrite (hopefully :p)
aape
Glad to hear you found a solution. We have some sample code on our support site (http://windemo.softartisans.com/OfficeWriter/latest/aspnet.aspx) and some in our wiki docs (http://wiki.softartisans.com/display/EW70/Introduction). Hopefully that'll be useful once you have some breathing room to take a second pass at your application.
Sean Kermes