简体   繁体   English

如何用VB.Net自动填充word文档

[英]how to auto fill a word document with VB.Net

I would like to create a Microsoft Word template that I can have a VB.net project auto fill specific fields in with database values. 我想创建一个Microsoft Word模板,我可以使用VB.net项目自动填充数据库值中的特定字段。 My question is how to best go about this with Word. 我的问题是如何用Word最好地解决这个问题。 Should I create a Template and add Fields, Bookmarks, or something else? 我应该创建模板并添加字段,书签或其他内容吗? I looked at fields but didn't see a way to create custom field names. 我查看了字段,但没有看到创建自定义字段名称的方法。 Ideally, I would like to create a group of templates that have the same "Field" names that my application can recognize and fill in. Any advice would be great. 理想情况下,我想创建一组具有相同“字段”名称的模板,我的应用程序可以识别并填写这些名称。任何建议都会很棒。

Thanks 谢谢

I would suggest that you follow the guide on MSDN: 我建议您按照MSDN上的指南进行操作:

http://social.msdn.microsoft.com/Forums/en/vbide/thread/1558f560-8ae6-413a-bbc4-aa8d5d912aac http://social.msdn.microsoft.com/Forums/en/vbide/thread/1558f560-8ae6-413a-bbc4-aa8d5d912aac

Essentially you are going to create a document with placeholders then use VB to open the document and replace those placeholders. 基本上,您将使用占位符创建文档,然后使用VB打开文档并替换这些占位符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM