Link to home
Start Free TrialLog in
Avatar of TOM BURKHARDT
TOM BURKHARDTFlag for Canada

asked on

In classic ASP exporting a table to Excel, how do I preset an Excel column width?

hi experts,
I have a Classic ASP page which takes data from a database and displays it dynamically as an HTML table.
The table is exported to an Excel file using this code:
      Response.ContentType = "application/vnd.ms-excel"
      Response.AddHeader "Content-Disposition", "attachment; filename=" & sndName & ".xls"
where sndName is the name I've assigned to the Excel file.

What I need is to preset one of the column widths to a value in Excel of 100.

I've tried doing it by setting the HTML width
both with <td width="100">
and also with <td style="width:100pt;">
but this does not seems to work.

Can anyone help me with this?
ASKER CERTIFIED SOLUTION
Avatar of Robin Uijt
Robin Uijt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TOM BURKHARDT

ASKER

I'm using Excel 2007. The file looks fine except for the one column which I want to arbitrarily set wider.
I even tried setting <td> width to 200, 300, 400, and 500, and each time it comes out the same width, about 34.5

I'm wondering if it is something in Excel 2007.

I will try a different computer with Excel 2000 set up on it, and get back to you.
aha! you are right. It works fine in Excel 2000, and in Excel 2003.

So there must be an idio(t)syncracy in Excel 2007.

Thanks, I will look further into this.

Points to you, as you did address my question.