Preserving HTML Column Widths in Excel
I have a web application that needs to export portions of certain pages to
Excel. To accomplish this I am generating the appropriate file with properly-formatted HTML and downloading them. It all works except that the column widths specified in the HTML are not being respected by Excel. I tried creating a simple HTML file on my local system, saving it both as an HTML file and as an XLS file. When I open the HTML file with IE it is formatted correctly. When I open the XLS file with Excel, again the column widths are not respected. A simple example is included below. Is there a way to get Excel to properly recognize the column widths specified in the HTML? Thanks in advance for your help. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" <html xmlns="http://www.w3.org/1999/xhtml" <head <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" / <titleUntitled Document</title </head <body <table width="576" border="0" cellspacing="0" cellpadding="0" <tr <td width="576" <table width="576" <tr <td width="576" <table width="576" <tr <td width="300"1</td <td width="200"2</td <td width="76"3</td</tr <tr <td width="300"4</td <td width="200"5</td <td width="76"6</td </tr <tr <td width="300"7</td <td width="200"8</td <td width="76"9</td </tr <tr <td width="300"10</td <td width="200"11</td <td width="76"12</td </tr </table </td </tr <tr <td width="576" <table width="576" <tr <td width="300"Line 1</td <td width="200"Col2</td <td width="76"Col3</td </tr <tr <td width="300"This is the second line</td <td width="200"Column 2 of the second line</td <td width="76"This is the third column of the second line. It is the longest column.</td </tr <tr <td width="300"1</td <td width="200"2</td <td width="76"3</td </tr </table </td </tr <tr <td width="576" <table width="576" <tr <td width="300"a</td <td width="200"b</td <td width="76"c</td </tr <tr <td width="300"d</td <td width="200"e</td <td width="76"f</td </tr </table </td </tr </table </td </tr </table </body </html |
All times are GMT +1. The time now is 02:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com