Prev: SessionID length differs between .NET and SQL Server
Next: Spurious data being inserted in field
From: j.t.w on 20 Jul 2010 21:33 Hi, How do you set the column width of a <td>? I'm using "Response.ContentType = "application/vnd.ms-excel" at the top of my page to change the web page to an excel spreadsheet. I've tried Response.Write("<td width=200>" & rst("Address") & "</td>") but, it doesn't seem to change the column width. Thanks if advance for any and all help. j.t.w
From: Bwig Zomberi on 21 Jul 2010 00:38 j.t.w wrote: > Hi, > > How do you set the column width of a<td>? I'm using > "Response.ContentType = "application/vnd.ms-excel" at the top of my > page to change the web page to an excel spreadsheet. > > I've tried Response.Write("<td width=200>"& rst("Address")& "</td>") > but, it doesn't seem to change the column width. > > Thanks if advance for any and all help. > > j.t.w Haven't checked this but it may work: <td style="width: 200px; "> -- Bwig Zomberi
From: Dan on 21 Jul 2010 06:27 "j.t.w" <j.t.w(a)juno.com> wrote in message news:c6fd4afc-0f5a-4b49-9889-67dc6d2b6365(a)i18g2000pro.googlegroups.com... > Hi, > > How do you set the column width of a <td>? I'm using > "Response.ContentType = "application/vnd.ms-excel" at the top of my > page to change the web page to an excel spreadsheet. > > I've tried Response.Write("<td width=200>" & rst("Address") & "</td>") > but, it doesn't seem to change the column width. > > Thanks if advance for any and all help. > > j.t.w You're not actually creating an Excel spreadsheet - you're using a trick of the MIME type to get the browser to load the resulting page in Excel, but the actual output is HTML and it's relying on the Excel HTML parser to convert it to an Excel spreadsheet format. So you need to figure out what Excel will parse, and what it will ignore, when processing HTML, and use that to figure out what attributes can be used. It might well be as simple as simply needing to enclose the width in quotes, eg. Response.Write("<td width=""200"">" & rst("Address") & "</td>") (when you want to include a double quote within a string, simply double it up so it's not treated as a string terminator). -- Dan
From: Bob Barrows on 21 Jul 2010 08:57 j.t.w wrote: > Hi, > > How do you set the column width of a <td>? I'm using > "Response.ContentType = "application/vnd.ms-excel" at the top of my > page to change the web page to an excel spreadsheet. > > I've tried Response.Write("<td width=200>" & rst("Address") & "</td>") > but, it doesn't seem to change the column width. > > Thanks if advance for any and all help. > > j.t.w Create a spreadsheet in Excel whose columns are set to the widths you want and then save it to html. View the source to see the markup that Excel needs to properly format the column widths.
From: j.t.w on 21 Jul 2010 17:27 Thank you all for your help and suggestions. I finally got it working properly. My problem was there were more than one Response.Write("<table>") in my code. Once I removed all but the outermost <table>, the width property started working. Thanks again. j.t.w
|
Pages: 1 Prev: SessionID length differs between .NET and SQL Server Next: Spurious data being inserted in field |