Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

Create input fields in Word. C#, ContentControl

02.11.2018 (👁57)


 

How do you add an input field from the developer tools in Word at runtime?

 

The real form fields in Word from the Developer Tools area are of type ContentControl.

These differ from the pure TextInputFields in that you can format the input fields and adjust the color.

 

 

In C # at runtime, programmatically

The actual add comes with Word.Document.ContentControls.Add (inputtype, destination)

_doc.ContentControls.Add(wdContentControlText, _app.Selection.Range)

 

In C #, interop, vsto:

ContentControl textField = _doc.ContentControls.Add(WdContentControlType.wdContentControlText, _app.Selection.Range);

 

Subject:

Programming in vba, C #

Word ContentControl

 

You can find the developer input fields under Word Menu-> Developer Tools-> Controls-> Aa (Text Only Content Control)

 

Example of use:

Here a real input field is added behind each photo.

If an entry has been made, the field appears as text

If the field receives the focus, the field is grayed out.

If no entry takes place, then the place can be displayed as an empty line or be marked in color.

 

C # input code, vsto in the example

Here a real input field is added behind each photo.

If an entry has been made, the field appears as text

//< add formfield field >

act_Image_Range.InsertAfter("\n");

_app.Selection.Start=act_Image_Range.End;

ContentControl textField = _doc.ContentControls.Add(WdContentControlType.wdContentControlText, _app.Selection.Range);

textField.Title = "Bild-Text";

textField.MultiLine = true;

textField.LockContentControl = true;

textField.Appearance = WdContentControlAppearance.wdContentControlHidden;

textField.SetPlaceholderText(Text:"                        ");

//</ add formfield field >

 

 

 

In C #, Visual Studio Vsto interop com