Freelance Project Requests info@CodeDocu.de Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net
#

Create input fields in Word. C#

 

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

 

Mobile
vba
»
Insert a line break at the end of a line and then insert text or a table
»
Word: insert characters at the end of a line
»
Text input fields in Word with vba c #
»
Create input fields in Word. C# ContentControls
»
Protect Word programmatically
»
Word vba: find current sentence
»
Word vba: Change document property title dynamically with Textbox Control
»
Word Code: Edit photos and controls in vba
»
Word: Find vba Code Example
»
Word vba macro: Changing WordArt with glow effect and shadow

.

Contact for Jobs, Project Requests: raimund.popp@microsoft-programmierer.de