Java Create Barcode to Word Document

This article demonstrates how to add barcode to a word document in Java applications with the help of Spire.Doc for Java. Firstly, please ensure that the barcode font has been install on the system. The installed font could be found from C:\Windows\Fonts.

import com.spire.doc.*;
import com.spire.doc.documents.Paragraph;
import com.spire.doc.fields.TextRange;

public class AddBarcodetoWord{
    public static void main(String[] args) {

        // Create Document
        Document document = new Document();
        //Add a section
        Section section = document.addSection();
        //Add  s paragraph to the section
        Paragraph para = section.addParagraph();

        //Add barcode and set format
        TextRange tr = para.appendText("H63TWX11072");

        //Save the document to file
        document.saveToFile("Barcode.docx", FileFormat.Docx);

Effective screenshot after add barcode to Word:

Java create Barcode to Word document