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

Avatar of undefined
Last Comment
TOM BURKHARDT
ASKER CERTIFIED SOLUTION
Avatar of Robin Uijt
Robin Uijt
Flag of Netherlands image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of TOM BURKHARDT
TOM BURKHARDT
Flag of Canada image

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.
Avatar of TOM BURKHARDT
TOM BURKHARDT
Flag of Canada image

ASKER

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.
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo