【发布时间】:2014-04-01 21:23:59
【问题描述】:
我正在尝试打开一个包含所有 html 内容的 .xls 文件。 在 html 内容中,我试图包含 2 个宽度为 100% 的表格(电子表格的视口宽度)。
如果我只包含第一个表,则 WIDTH=100% 有效。但是当我包含第二张桌子时,两个桌子的宽度似乎都是自动的,而不是只适用于 1 张桌子的宽度。
以下是 .xls 文件的内容:
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="application/vnd.ms-excel; charset=UTF-8">
<TITLE>Open in Excel as well as browser (this is ignored by Excel)</TITLE>
</HEAD>
<BODY>
<H2>Useful HTML tags understood by Excel</H2>
<BLOCKQUOTE>The list given below is not an exhastive list of all tags understood by Excel.
Where there are several codes that achieve the same effect, I
have only included one of them.</BLOCKQUOTE>
<TABLE BORDER=YES WIDTH=100%>
<TR>
<TH WIDTH=20%><B>Tag</B></TD>
<TH WIDTH=30%><B>Valid Attributes</B></TD>
<TH WIDTH=50%><B>Excel interpretation</B></TD>
</TR>
<TR>
<TD>TD</TD>
<TD>BGCOLOR=colour</TD>
<TD BGCOLOR=YELLOW>Background colour for the cell</TD>
</TR>
<TR>
<TD>B</TD>
<TD ALIGN=CENTER>-</TD>
<TD><B>Bold</B></TD>
</TR>
<TR>
<TD>TD, TH</TD>
<TD>ROWFIELD</TD>
<TD>Pivot table: Type of pivot table</TD>
</TR>
</TABLE>
<BR/><BR/><BR/>
<TABLE BORDER=YES WIDTH=100%>
<TR>
<TH WIDTH=20%><B>Tag</B></TD>
<TH WIDTH=30%><B>Valid Attributes</B></TD>
<TH WIDTH=50%><B>Excel interpretation</B></TD>
</TR>
<TR>
<TD>TABLE</TD>
<TD>ALIGN=LEFT|RIGHT|CENTER|JUSTIFY</TD>
<TD>Table and its placement</TD>
</TR>
<TR>
<TD>TABLE</TD>
<TD>WIDTH=nn</TD>
<TD>Size of entire table</TD>
</TR>
<TR>
<TD>TABLE</TD>
<TD>CROSSTABGRAND=NONE|ROW|COLUMN|ROWCOLUMN</TD>
<TD>Pivot table: where grand totals to be placed</TD>
</TR>
<TR>
<TD>TD, TH</TD>
<TD>ROWFIELD</TD>
<TD>Pivot table: Type of pivot table</TD>
</TR>
</TABLE>
</BODY>
</HTML>
要明确,我的要求是我需要渲染 2 个 html 表格,宽度均为 100%。
如果您有任何疑问,请发表评论。
【问题讨论】:
标签: html excel html-table