Received : 2007/09/26 00:08:49
Message : I am using ASPOSE.Cells to generate .xls files on my server.
I use a template .xls file which contains data markers.
This .xls file needs to be populated using datasource.
Following is the code I am using,
Dim License
Set License = Server.CreateObject("Aspose.Cells.License")
License.SetLicense "C:\Program Files\Aspose\Aspose.Cells\License\Aspose.Total.lic"
Dim objSAXLTmplt
Set objSAXLTmplt = Server.CreateObject("ASPOSE.Cells.WorkbookDesigner")
'--- Use the ExcelTemplate object's Open method to
'--- open the template simpletemplate.xls.
objSAXLTmplt.Workbook.Open_5 Server.MapPath(myTemplate)
'--- Set the template's datasource to the Recordset
'--- returned from the database. DataSource("Recordset")
'--- refers to the recordset specified by the template's
'--- data markers (&=$Recordset.ColumnName).
objSAXLTmplt.SetDataSource_5 myTemplate,(rs)
'--- Generate the spreadsheet, and open it in the browser.
'--- The Process method takes two parameters: the name and
'--- path of the generated spreadsheet, and an optional
'--- process method.
Dim myTempfile, myTempfileFullPath
myTempfile = generateFileName()
myTempfileFullPath = TempDir & myTempfile
'create the file, save it on disk
objSAXLTmplt.Process_3 'myTempfileFullPath, saProcessDefault
Dim stream
set stream = objSAXLTmplt.Workbook.SaveToStream()
Response.Clear
Response.ContentType = "http://gemsdev1.pfizer.com/Excelwriter/vnd.ms-excel"
Response.AddHeader "content-disposition","attachmnet; filename = rp_ReportMeetingPlanningStatus_template1.xls"
Dim bytes
bytes = stream.ToArray()
Response.BinaryWrite(bytes)
Set objSAXLTmplt = nothing
'--- Close Recordset
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
The problem I am facing is that the excel sheet gets generated but it doesnot get populated.
Kindly, suggest me the solution to this.
Thanks,
DOSHIS
This message was posted using Aspose.Live 2 Forum