Free Support Forum - aspose.com

Classic asp creating .xlsx file

Hi, I am a newbie trying to create xlsx file using classic asp. Can any point me in right direction?

I appreciate your help...

Thanks, RK

Hi,

Please see the complete article with respective documents for your reference on how to use Aspose.Cells in other languages:
Utilize Aspose.Cells in other Programming Languages

Thank you.

With all due respect, I have been thru those links prior to posting this query. The problem I am facing is with .xlsx files. All the examples in the documentation point to .xls files which is no problem at all. If I replace, .xls with .xlsx in the examples mentioned, I am getting error messages in the excel file.

So kindly point me in right direction... There is no documentation or examples for creating .xlsx (2007 or 2010 format excel files)

Thanks in advance...

Hi,

Following is my VB Script (classic ASP) code to generate an XLSX file that works fine here. I have also attached my output XLSX file here.

Note: Just for your knowledge, please do not use Workbook.SaveToStream() method to get the stream to response to XLSX file. This method only works for XLS files.

Sample code (Testing2.asp):

<%@ LANGUAGE = VBScript %>
<% Option Explicit %>



Aspose.Cells classical ASP sample



<%

'Create a Workbook object
Dim xls
Set xls = CreateObject(“Aspose.Cells.Workbook”)
'Put data into the workbook
Dim sheet
'Get the first worksheet (default worksheet)
Set sheet = xls.worksheets.item(0)
Dim cells
Set cells = sheet.cells
Dim cell
Set cell = cells.item_3(“A1”)
cell.PutValue_5 “Hello World!”
'Save the document to the stream
Dim stream
xls.Save_4 “e:\test2\asptesting.xlsx”

%>



Thank you.

Hi Amjad, I have used your code without any modification and I am getting the below error message..

Excel found unreadable content in 'asptesting.xlsx'. Do you want to recover the contents of this workbook? If you trust the source of this workboo, click Yes.

Thanks,

Hi,

I think you might be using some older version of Aspose.Cells or you have registered some older Aspose.Cells.dll (assembly). Please use our latest version e.g v5.3.3.x (you may download from the site and install it). When you simply install it, it will also register the assembly on your machine.

Also, you may try to install manually by command utility, see the document for your reference:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/accessing-component-from-com-clients.html

Also, tell me could you open my attached xlsx file on your MS Excel 2007/2010, for your information it opens and works fine.

Thank you.