Navigate and editing a table

Hello!
I successfully builded a simple table. But now, i want to navigate to a specific cell, edit the text inside the cell and jump back to the end of the table(the old position?) and append more cells.
I tried something like this:

Paragraph par_Buffer = builder.getCurrentParagraph();
Cell cell_Buffer = lst_Date_Cells.get(j);
if (null != cell_Buffer)
{
    builder.moveTo(cell_Buffer.getFirstParagraph());
    builder.writeln(str_Wert);
}
builder.moveTo(par_Buffer);
builder.insertCell();
// builder is a DocumentBuilder object
// j is an integer from a surrounding for()
// lst_Date_Cells is a list of cells, i want to edit
// At the end of this process, i want to insert another new cell

This code produces a very bad table structure… So, i don’t have any ideas to slove this problem. Please help me.

Hi

Thanks for your request. I cannot reproduce the problem on my side. I use the following code for testing:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Start table
Table table = builder.startTable();
// Insert first row
builder.insertCell();
builder.insertCell();
builder.endRow();
// Insert second row
builder.insertCell();
builder.insertCell();
builder.endRow();
// Start third row
builder.insertCell();
// Move document builder into the second cell of the first row in the current table.
Node node = builder.getCurrentParagraph();
builder.moveTo(table.getRows().get(0).getCells().get(1).getFirstParagraph());
builder.write("this is some string");
// Move document builder to its old position
builder.moveTo(node);
// Continue the third row.
builder.insertCell();
builder.endRow();
// insert fourth row
builder.insertCell();
builder.insertCell();
builder.endRow();
builder.endTable();
doc.save("C:\\Temp\\out.doc");

Best regards.

Thank you very much! With your code, i fixed the problem.