This short tutorial describes how to insert a content control in Word using Java. Includi istruzioni passo-passo, configurazione dell’IDE e codice di esempio per aggiungere vari controlli, incluso un controllo di contenuto di testo ricco usando Java. You will also learn how to improve the output file by applying various parameters to the controls.
Steps to add MS Word content control with Java.
- Set the IDE to use Aspose.Words for Java to add content controls.
- Apply the license to avoid evaluation restrictions, create a Word file, and add a header.
- Insert a rich text content control, add formatted text, and protect the control from deletion.
- Add a simple text control with some text inside it.
- Aggiungi un checkbox per selezionare o cancellare un’opzione
- Add a dropdown list with some predefined options and select a default option.
- Add a date picker control to select a date from a calendar.
- Save the document with the new controls generated via structured document tag.
These steps show you how to add and customize Word document content control using Java. Import the necessary classes and modules and create a new Word file in memory using the Document object. Use StructuredDocumentTag to add multiple controls with the help of the SdtType enumeration, using options such as RICH_TEXT, PLAIN_TEXT, DROP_DOWN_LIST, and DATE.
Code to add Word content controls with Java
This code shows how to insert a content control in Word using Java. È possibile impostare simboli personalizzati per selezionato e non selezionato sulla casella di controllo, abilitare il multilinea per il controllo di testo semplice e utilizzare una casella combinata al posto dell’elenco a discesa per la priorità se si desidera che gli utenti inseriscano il proprio valore. There is also an option to mark the plain text control as temporary, so that it disappears and leaves only plain text once the user modifies it.
This guide explains the process for creating content controls in a Word file. Per convertire un DOCX in JPG, consulta l’articolo Convert DOCX to JPG using Java.