Hi,
Hi Sivaraj,
Thanks for your inquiry. Please use the following code example to achieve your requirements. Hope this helps you.
If you still face problem, please share your expected output document here for our reference. We will then provide you more information about your query along with code.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// We want to insert a field like this:
// { IF 1 = 1 table contents "Simple text" }
Field field = builder.insertField("IF ");
builder.moveTo(field.getSeparator());
builder.write(" 1 = 1 ");
// We call this method to start building the table.
builder.startTable();
builder.insertCell();
builder.write("Row 1, Cell 1 Content.");
// Build the second cell
builder.insertCell();
builder.write("Row 1, Cell 2 Content.");
// Call the following method to end the row and start a new row.
builder.endRow();
// Build the first cell of the second row.
builder.insertCell();
builder.write("Row 2, Cell 1 Content");
// Build the second cell.
builder.insertCell();
builder.write("Row 2, Cell 2 Content.");
builder.endRow();
// Signal that we have finished building the table.
builder.endTable();
builder.write(" \"Simple text\" ");
// Finally update the outer field to recalcaluate the final value. Doing this will automatically update
// the inner fields at the same time.
field.update();
doc.save(MyDir + "Out.docx");