Last active
June 11, 2022 09:47
Code to Make a Fillable Form in Word using Java. Refer to this link for more information: https://kb.aspose.com/words/java/how-to-make-a-fillable-form-in-word-using-java/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.aspose.words.BreakType; | |
import com.aspose.words.Document; | |
import com.aspose.words.DocumentBuilder; | |
import com.aspose.words.License; | |
import com.aspose.words.TextFormFieldType; | |
public class MakeAFillableFormInWord { | |
public static void main(String[] args) throws Exception {//main function for how to make a fillable form in Word using Java | |
// Load license | |
License lic = new License(); | |
lic.setLicense("Aspose.Total.lic"); | |
// Create a document | |
Document formDoc = new Document(); | |
// Create a DocumentBuilder object | |
DocumentBuilder formBuilder = new DocumentBuilder(formDoc); | |
// Insert text input | |
formBuilder.insertTextInput("TxtInputControl", TextFormFieldType.REGULAR, "", "The Text Input Control", 0); | |
formBuilder.insertBreak(BreakType.LINE_BREAK); | |
// Insert checkbox | |
formBuilder.insertCheckBox("CheckBoxControl", true, true, 0); | |
// Save the document | |
formDoc.save("outputJava.docx"); | |
System.out.println("Done"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment