从HTML编辑器创建和下载Word文件 [英] Create and download word file from html editor
本文介绍了从HTML编辑器创建和下载Word文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已从下载html编辑器为ASP.NET AJAX创建HTML编辑器 [
I have downloaded html editor from How to Create an HTML Editor for ASP.NET AJAX[^] and it is working fine... now i want to download a word file using contents of that editor... i have tried code and also search on google but in wain.. please help me... Thanks in advance...
推荐答案
你好,
有一个非常简单的方法.
只需获取在此控件中创建的HTML,然后将其放入HTML标记中,并将其MIME类型设置为"application/msword",然后将其另存为.Doc文件即可.不要使用.Docx,因为它将无法工作.
它不会创建真正的Word文档,但Word会理解它,将其正确加载并呈现,从用户的角度来看,它没有任何区别.
Hello,
There is a very easy way to do that.
Just get the HTML created in this control and put it inside an HTML tag with the mime type set to "application/msword", then just save as a .Doc file. Don''t use .Docx as it won''t work.
It won''t create a real Word document, but Word will understand it, load it and render it properly, and from a user point of view it makes no difference.
<html type="application/msword">
<h1>Heading 1</h1>
<p>This text is <strong>bold</strong>, this <em>italic</em>, and this <span style="text-decoration: underline">underlined</span>.</p>
<div dir="ltr" style="margin-left: 40px"><div dir="ltr" style="margin-left: 40px"><div dir="ltr" style="margin-left: 40px"><div dir="ltr" style="margin-left: 40px"><p>This text is <span style="font-family: Arial">Arial</span>, this <span style="font-family: Garamond">Garamond</span>, and this <span style="font-family: Verdana">Verdana</span>.</p></div></div></div></div>
<ul>
<li>Bullet 1 </li>
<li>Bullet 2</li>
</ul>
</html>
瓦莱里.
Valery.
这篇关于从HTML编辑器创建和下载Word文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文