Click here to Skip to main content
15,904,023 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a word template and it got some fileds that I need to fill with the information I enter form a TextBox. This fields can be identified by bookmarks or by "<filedname>". I wanna want to insert that Text in specific font and font size. How can I do that? I need some example code since I'm a newbie to this. The language is C#. Thanks
Posted
Updated 28-Apr-12 6:05am
v2
Comments
member60 28-Apr-12 1:02am    
use Improve Question tag to edit the details instead of reposting the query and add replies and comments to related posts

1 solution

If you got the template of Word document and you want to feel it with some data (text), use CustomDocumentProperties[^].

You can do it in code (follow the above link), but i want to demonstrate how it works:
1) Create new document
2) Add new CustomDocumentProperty (menu File->Propeties [bookmark:] Nonstandard
a) Name: AAA1
b) Type: Text
c) Value: "Some text"
d) push Add and OK button
3) Insert this property into document (menu Insert->Field->DocProperty, choose AAA1, click OK button)

What you see? "Some text". Right-click on it and you'll see the menu for document-fields.
In the same way, as you add CustomDocumentProperty, you can change it. The difference is in step 2. Instead add, choose AAA1 property and change it values.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900