Using VBScript to generate Excel


#1

Good Afternoon,

I just downloaded a trial version of Aspose.excel and I'm hoping you will be able to help me. My goal is to use VBScript inside a report generation tool to create Excel files using your product. I have done this for years using VBScript and Excel/Word calls on our client machines. We are moving to a thin version of our ERP system and I'm looking for a product that I can install on the server and have the excel files created there. Do you have any examples in VBScript that show how your product is used to create an excel file. We do not do anything fancy in the Excel files generated, generally just bolding, formatting columns to text and autofitting columns.

Thanks for any help you can provide,

Lou


#2

Please check http://www.aspose.com/wiki/default.aspx/Aspose.Excel/AccessingComponentFromCOMClients.html .


#3

Thanks Laurence but I have already looked at that post and tried the example. I get an error that putvalue_4 is an invalid procedure call or argument. How does one know what number to put in there? I found another post in the forum where someone was using different numbers than the example. Do these numbers always stay consistent for a server, a site or always change?

Thanks,

Lou


#4

I have had some success with a simple vbscript, I ended up using the following:

cells.item_3

putvalue_5

save_2

I'm going to try a few more things in Vbscript and then move this inside my report writer and see how that goes.

Thanks,

Lou


#5

I'm trying to set a style to bold a row and get an error that "object required: styles.add()", here is my code perhaps I have to put a number somewhere:

dim sheet
set sheet = xls.worksheets.item(0)
dim cells
set cells = sheet.cells
dim cell
set cell = cells.item_2(0,0)
cell.putvalue_5 "number"
set cell = cells.item_2(0,1)
cell.putvalue_5 "string"

set cell = cells.item_2(1,0)
cell.putvalue_5 343
set cell = cells.item_2(1,1)
cell.putvalue_5 "342987dhfkdhf983ifhhkf"

dim boldstyle
set boldstyle = xls.styles.add()
dim boldit
set boldit = xls.styles(boldstyle)
boldit.font.isbold = true

xls.save_2("c:\lou.xls")

set xls = nothing

Thanks,

Lou


#6

I think your should change this line of code:

set boldit = xls.styles(boldstyle)

to

set boldit = xls.styles.item_2(boldstyle)

Aspose.Excel is a .NET component so it's better to use it in an ASPNET application. If you have to use it in an ASP application, I think it's better to write a wrapper class in .NET. This wrapper class can provide more simple interface to be called in ASP applications.