将网页复制到 Word 或其他文字处理程序中
我正在 ASP.NET (2.0) 中开发一个 Web 应用程序,其中用户需要能够将页面中的大量内容复制到 MS Word 等文字处理程序中,以便在小册子或讲义中使用它某种。
看来,仅仅选择页面上的内容进行复制和粘贴并不总是有效。例如,Word 似乎没有收到任何通过类而不是内联样式实现的样式信息。以编程方式创建 Word 文档看起来很复杂,并且限制了我只能使用一个客户端文字处理器。
解决这个问题的最佳方法是什么?
I'm working on a web app in ASP.NET (2.0) in which the user needs to be able to copy a bunch of content from a page into a word processor like MS Word in order to use it in a brochure or handout of some sort.
It appears that simply selecting content on a page to copy and paste does not always work well. For example, Word doesn't seem to receive any style info that was achieved via classes and not inline styles. And programmatically creating a Word document looks complicated and limits me to one client word processor.
What is the best way to approach this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我发现从 Internet Explorer 复制网页的效果比其他浏览器更好。
您可能会幸运地使用“Word 打印驱动程序”,以便用户只需打印到 Word。特别是如果网页通过新页面有打印版本或者使用 CSS 打印样式表。
我从未使用过,但此搜索结果似乎表明您可以购买一个。
http:// /www.google.com.au/search?sourceid=chrome&ie=UTF-8&q=print+to+word+printer+driver
I find copying a web page from Internet Explorer has better results than other browsers.
You may have luck using a "Word Print Driver" so users just print to word. Especially if the webpage has a print version either via a new page or they are using a CSS print stylesheet.
I have never used one but this search result seems to suggest that you can get one.
http://www.google.com.au/search?sourceid=chrome&ie=UTF-8&q=print+to+word+printer+driver
我建议查看 Winnovative HTML 到 PDF 转换器。您只需向其传递一个 URL,它就会将其转换为 PDF。无论如何,PDF 通常更适合此类内容。
http://www.winnovative-software.com/
I would suggest looking into the Winnovative HTML to PDF converter. You can just pass it a URL and it will convert it into a PDF. PDFs are generally better for that type of content anyway.
http://www.winnovative-software.com/
我同意瓦拉马斯的观点。处理此类请求的最佳方法是打印到文件并使用 CSS。只需将链接中的媒体标签设置为要打印的 CSS 文件(默认设置为屏幕)。
I agree with Valamas. The best way to handle this type of request is to do a print to file and use CSS. Just set the media tag in your Link to the CSS file to print (which is set to screen by default).