Spreadsheet column width from html

S

sumithar

I am trying to create a spreadsheet from mysql data via a php page. I
have the
requisite headers in place for content type and all that.
All I am doing is executing the SQL query and displaying the retrieved
data formatted in an HTML table. Each <td>blah</td> corresponds to a
cell in the spreadsheet

Whatever width I assign to the HTML table columns ( using <td
width="nnn"> it doesn't have any impact on the width of the
spreadsheet column- that is always staying the same.Any idea how to specify the width?The headers I am using are as follows
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: attachment; filename=report.xls");
header("Pragma: no-cache");
header("Expires: 0");
 
T

Tim Williams

Have you tried something like

<td style="width: 200px">content</td>

?

You might also consider using an XML file (obtained by saving a "template"
report in XML format from Excel) and then inserting your queried content
into that file (eg. by replacing a piece of placeholder text).

Tim
 
S

sumithar

Have you tried something like

<td style="width: 200px">content</td>

?

You might also consider using an XML file (obtained by saving a "template"
report in XML format from Excel) and then inserting your queried content
into that file (eg. by replacing a piece of placeholder text).

Tim









- Show quoted text -

Thanks for the XML tip. Turns out the problem I had was 'cos I didn't
realise I was trying to open the spreadsheet w/ Open Office calc. It
works the way I want it to with Excel. The width attribute in <td>
does control the width of the Excel column as well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top