Hello,
Attached are two images. One is what we have so far and the other is the desired table.
We’ve tried various things but can’t seem to get the desired table.
The desired table should have a solid line
on rows separating the merged cells.
Think of it like grouping multiple rows via the merged cell.
The non-merged rows in a group should be separated by a dotted line
.
current.png (1.3 KB)
desired.png (1.9 KB)
Below is a sample code of what we have so far…
using Aspose.Words;
using Aspose.Words.Tables;
using System;
using System.Diagnostics;
int i = 1;
var doc = new Document();
var builder = new DocumentBuilder(doc);
builder.StartTable();
builder.RowFormat.Borders.Horizontal.LineStyle = LineStyle.Dot;
InsertCellAuto();
InsertCell("merge 1");
builder.CellFormat.VerticalMerge = CellMerge.First;
builder.EndRow();
builder.CellFormat.VerticalMerge = CellMerge.None; //reset
InsertCellAuto();
InsertCellAuto();
builder.CellFormat.VerticalMerge = CellMerge.Previous;
builder.EndRow();
builder.CellFormat.VerticalMerge = CellMerge.None; //reset
InsertCellAuto();
InsertCell("merge 2");
builder.CellFormat.VerticalMerge = CellMerge.First;
builder.EndRow();
builder.CellFormat.VerticalMerge = CellMerge.None; //reset
InsertCellAuto();
InsertCellAuto();
builder.CellFormat.VerticalMerge = CellMerge.Previous;
builder.EndRow();
builder.EndTable();
string fileName = $"{DateTime.Now.ToString("HHmmss")}.docx";
doc.Save(fileName);
Process.Start(fileName);
void InsertCellAuto() => InsertCell(i++.ToString());
void InsertCell(string text)
{
builder.InsertCell();
builder.Writeln(text);
}