How to apply the external table cell formatting to the internal table cell

Continuing the discussion from Insert dynamic row column in table:

In the above issue I have described how I am adding a table inside another table.
In short I will describe here, I have one table named as table1 which has 4 rows, and I have adding one more table named table2 which has 2 rows. This table2 I am adding inside the row3 of table1.
So if we consider table1 is outside table and table2 is inside table, then I have to apply table1 cell formatting to table2 cell. Could you please guid on same.
attaching a code snippet ( not complied code as I can’t share the full source code ) for your reference.

@vke3

Thanks for your inquiry. Could you please share your input and expected output documents here for our reference? We will then provide you more information about your query.

@tahir.manzoor,

I manage to do that, and now its working.
I have another doubt. Sharing you the Files, Files.zip (41.1 KB)

In Zip folder you will find docx file named PLD_SZ8 Product Legacy 2015-11-2_B_Draft.docx. In docx file you will find one table which is divided on 1st and 2nd page because of page break. I wanted to get the top border of the table which is on 2nd page ( 2nd part of table after page break) . Could you please update me how to get the top border location after page break ( I have highlighted the part in docx file). I want to change that border style but I am not able to find the location of that border using ASPOSE library (i.e. inline table to not have a border at page break).

@vke3

Thanks for your inquiry. Please use the following code example to get the first row of table on second page of document and set its top border. Hope this helps you.

Document doc = new Document(MyDir + "in.docx");
LayoutCollector collector = new LayoutCollector(doc);

Table table = doc.getFirstSection().getBody().getTables().get(0);
int page = 1;
for (Row row : (Iterable<Row>) table.getRows())
{
    if(collector.getStartPageIndex(row) != 1)
    {
        System.out.println(row.getText());
        for(Cell cell : row.getCells())
        {
            cell.getCellFormat().getBorders().getTop().setLineStyle(LineStyle.DOT);
        }
        break;
    }
}
doc.save(MyDir + "18.12.docx");