我有像贝洛一样的html格式的短片
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><head><style><!--
/*paged media */ div.header {display: none }
div.footer {display: none } /*@media print { */
@page { size: A4; margin: 10%; @top-center {
content: element(header) } @bottom-center {
content: element(footer) } }
/*font definitions*/
/*element styles*/ .del
{text-decoration:line-through;color:red;}
.ins {text-decoration:none;background:#c0ffc0;padding:1px;}
/* Word style definitions */
/* TABLE STYLES */
/* PARAGRAPH STYLES */
.DocDefaults {display:block;space-after: 4mm;line-height: 115%;font-family: Calibri;font-size: 11.0pt;}
.Normal {display:block;}
/* CHARACTER STYLES */ .DefaultParagraphFont {display:inline;}
/* TABLE CELL STYLES */
--></style><script type="text/javascript">
function toggleDiv(divid){
if(document.getElementById(divid).style.display == 'none'){
document.getElementById(divid).style.display = 'block';
}else{
document.getElementById(divid).style.display = 'none';
}
}
</script></head><body>
<!-- userBodyTop goes here -->
<div class="document">
<p class="Normal DocDefaults "><span style="font-weight: bold;">Hi</span><span style="white-space:pre-wrap;"> </span>[name]<span style="white-space:pre-wrap;">. </span><span style="font-weight: bold;color: #FF0000;">your</span><span style="white-space:pre-wrap;"> ac is</span><span style="white-space:pre-wrap;"> </span>[acc_no]<span style="white-space:pre-wrap;">, and </span><span style="font-weight: bold;color: #FF0000;">your</span><span style="white-space:pre-wrap;"> password </span><span style="white-space:pre-wrap;">is </span>[password].</p>
<p class="Normal DocDefaults ">Thanks you.</p></div>
<!-- userBodyTail goes here -->
</body></html>
我想使用此字符串创建.doc或.docx文件。 doc或docx应保存在目录和DB中的链接下载。该怎么办?
答案 0 :(得分:0)
我是iOs开发人员,但我能够将html转换为.docx。 请更换&amp;将以下代码添加到您的HTML文件中;请将文件扩展名更改为.dcox /,doc
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:w=\"urn:schemas-microsoft-com:office:word\" xmlns=\"http://www.w3.org/TR/REC-html40\"><body>"
希望这对你有用。
答案 1 :(得分:0)
test1