本文介绍了如何将包含大量表格的HTML文档转换为Word文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个包含很多表格的HTML文档。如何将文档转换为Word?

I have created an HTML document with many tables. How can I convert the document to Word?

问题是,如果我用Word打开一个HTML文档,出于某种原因,我会得到非标准的双行表。 $ b

The problem is that if I open an HTML document with Word, I get non-standard double-lines tables for some reason.

<table border="1" color="#000000" cellpadding="0" cellspacing="0" width=100%>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td width = 15%>0</td>
<td width = 15%>0</td>
<td width = 40%>0</td>
<td> - </td>
</tr>
</table>


推荐答案

解决了将大量表格转换为Word文档的问题使用CSS样式。用Word打开Generate.html所有表正常

Solved the problem convert a lot of tables to Word document using css styles. After open Generate.html with Word all tables normal

文件CSSTable.css

File CSSTable.css

table.CSSTable {
border-width: 1px;
border-spacing: 0px;
border-style: solid;
border-color: black;
border-collapse: collapse;
background-color: white;
}
table.CSSTable th {
    border-width: 1px;
    padding: 0px;
    border-style: solid;
    border-color: black;
    background-color: white;
    -moz-border-radius: ;
}
table.CSSTable td {
    border-width: 1px;
    padding: 0px;
    border-style: solid;
    border-color: black;
    background-color: white;
    -moz-border-radius: ;
}

Generate.html

Generate.html

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<link rel="stylesheet" href="CSSTable.css" type="text/css">
</head>
<body>
<table class="CSSTable" width=100%>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td width = 15%>0</td>
<td width = 15%>0</td>
<td width = 40%>0</td>
<td> - </td>
</tr>
</table>

这篇关于如何将包含大量表格的HTML文档转换为Word文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 01:52