我正在导出包含从.mhtml文件转换的图像的word文档。 我引用了以下链接来导出单词。
http://www.revium.com.au/articles/sandbox/aspnet-mvc-convert-view-to-word-document/
现在这个词正在导出,但它在网页布局中。但我需要打印版面中的文档。
任何人都可以帮我解决这个问题。
被修改
我在下面的链接
的帮助下解决了这个问题http://forums.aspfree.com/asp-development-5/open-ms-word-documents-print-layout-view-57860.html
您可以随时对其进行逆向工程。用文字打开你的文档。按照您想要的方式进行操作并将其另存为html。使用文本编辑器打开并使用您需要的内容。
这就是我的所作所为。
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<title></title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Print</w:View>
</w:WordDocument>
</xml><![endif]-->
</head>
我还添加了一些由我的单词生成的额外代码,然后才正确使用它。
希望这能帮助面临同样问题的人。
答案 0 :(得分:0)
将文件写入响应库,从流中获取字节并尝试。它应该强制下载文件
HttpResponseBase.OutputStream(fileBytes,0,fileBytes.GetLength(0));