将数据库中的 HTML 邮件合并到 MS Word 中
项目:使用 VB.NET 构建 winforms 数据库界面和工作自动化应用程序。
我正在使用此编辑器让用户在数据库界面环境中输入文本,该环境将加载/保存/向他们展示表单中正在处理的内容,并通过邮件合并到等待内容的 Word 文档中。我可以执行第一步并且效果很好,但是如何让 MS Word 将 HTML 识别为格式,而不是仅仅将标签和文本全部合并为文本?
该工具有两个相关属性:一是仅获取文本(无标记,即无 HTML),二是获取文本。获取 HTML 的完整标记。这两个都是文本格式(我用它来方便地存储在数据库中)。
我能想到的想法/方向:
1)使用剪贴板。我可以将内容直接从编辑器窗口复制/粘贴到 Word,效果非常好!但是,即使以编程方式使用剪贴板,从数据库加载也有很大不同。 (也许我不明白如何使用剪贴板工具)
2)也许Word中有一个库或类/函数可以将HTML理解为“可合并”内容?
谢谢!
:-担
project: Using VB.NET to build a winforms database interface and work-automation app.
I am using this editor for the users to enter their text in the database interface environment that will both load/save/show them what they are working on in the form and also mail-merge into a Word document waiting for the content. I can do the first step and it works well, but how do I get MS Word to recognize HTML as formatting instead of just merging in tags and text all as text?
The tool has two relevant properties: one to get just the text (no markup, i.e. no HTML) and one to get the full markup with HTML. Both of these are in text format (which I use for easy storage in the Database).
ideas/directions I can think of:
1) use the clipboard. I can copy/paste the content straight from the editor window to Word and it works great! But loading from a database is significantly different, even when using the clipboard programatically. (maybe I don't understand how to use the clipboard tools)
2) maybe there is a library or class/function in Word that can understand the HTML as "mergable" content?
thanks!
:-Dan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用我们的 (SautinSoft) .Net 库将您的每个 HTML 数据转换为 Word 文档。
接下来,您可以将所有生成的 Word 文档合并为单个 Word 文档。该组件还具有合并Word文档的功能。
这是链接下载组件: http://www.sautinsoft.com/ products/html-to-rtf/download.php
这是在内存中将 HTML 转换为 Word 文档的示例代码:
这是在内存中合并两个文档的示例代码:
You may use our (SautinSoft) .Net library to transform each of your HTML data to Word document.
Next you may merge all produced Word documents into single Word document. The component also have function to merge Word documents.
This is link download the component: http://www.sautinsoft.com/products/html-to-rtf/download.php
This is a sample code to transform HTML to Word document in memory:
This is a sample code to merge two documents in memory:
我最终使用剪贴板来设置文本。这是我回答这个问题所需的代码示例。
我只是不知道如何告诉计算机内容是 HTML 还是 RTF 等。结果很简单。
:-担
I ended up using the clipboard to set the text. Here is a code sample that I needed to answer this question.
I just didn't know how to tell the computer that the content was HTML or RTF etc. It turned out to be simple.
:-Dan