views:

13

answers:

2

hi,

I am using ASP to Import data from SQL server and then export it to excel.

I though want a header text in row 1 ie cells a1 to n1 But how do I write command that can merge those fields ? then I would be able to insert my header txt.

I have this asp code:

'setup the excel file
Dim objFSO, objExcelFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
 excelfilename = "Financials_clients_" & nn & ".xls"
Set objExcelFile = objFSO.CreateTextFile(Server.MapPath(excelfilename))



'Do the header information
objExcelFile.writeline ("<html>")

objExcelFile.writeline ("<table border=1>")

'This header is just shown in one cell ie A1 ... I want it from a1 - n1 
objExcelFile.writeline (" <td bgcolor=#cccccc> CLIENT LEVEL - " & product_header & "</td>")

any other suggestions are highly appreciated.

thx Djan, exe2911jan @ yahoo.co.uk

A: 

Your code is outputting everything in one cell, you would need to change it to output in multiple table cells.

objExcelFile.writeline (" <td bgcolor=#cccccc> CLIENT LEVEL - " & header1 & "</td><td>" & header2 & "</td><td>" & header3 & </td>........")
Chris Diver
A: 

Hi Chris,

Appreciate your feedback !!!

Will give it a try when back at job.

cheers Djan

Djan