当前位置:网站首页>Aspose. Words merge cells

Aspose. Words merge cells

2022-07-07 22:22:00 Hey, hey, hey, hey, hey

By means of Word Add data to the field transaction table ,

When the data is added , You need to merge the specified cells vertically .

//doc:word file 、tableIndex: Table subscript 、startRow: Line start subscript 、endRow: Line termination subscript 、CellIndex: Column subscript 
private void MergeCells(Document doc,int tableIndex,int startRow,int endRow,int CellIndex)
{
    if(endRow - startRow <= 1) return;
    Table table = (Table)doc.GetChild(NodeType.Table,tableIndex,true);
    table.Rows[startRow].Cells[CellIndex].CellFormat.VerticalMerge = CellMerge.First;
    for(int i = startRow + 1; i <= endRow; i++)
    {
        table.Rows[i].Cells[CellIndex].CellFormat.VerticalMerge = CellMerge.Previous;
    }
}

Aspose.Word operation Word file ( One )

Aspose.Word operation Word file ( Two )

原网站

版权声明
本文为[Hey, hey, hey, hey, hey]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130606206883.html