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?
ASPMicrosoft Excel

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

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.
Your help has saved me hundreds of hours of internet surfing.