开发者

Change blank fields in .doc file. WPF

开发者 https://www.devze.com 2023-04-06 16:17 出处:网络
I have a .doc document. In this document i have some blanks for data. For example: \"car_id\" is the best car in \"car_country\".

I have a .doc document. In this document i have some blanks for data. For example:

"car_id" is the best car in "car_country".

开发者_运维知识库

I need to open this doc file and change this blanks ("car_id", "car_country") to data from some object.

How to do this?


I would use DocumentFormat.OpenXml.dll. You can find it here. OpenXMLSDKv2.msi will add assembly. You will just need to add reference to DocumentFormat.OpenXml. And the OpenXMLSDKTool.msi will install a usefull tool that will display xml structure of .docx (for example) document.


This web page has some very good samples of Word automation using C#. Specifically, look at section 6 in the web page for a Mail Merge example.

http://www.c-sharpcorner.com/UploadFile/amrish_deep/WordAutomation05102007223934PM/WordAutomation.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号