We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Table Cell ColSpan as 5 and text center

Table table = builder.StartTable();

//Row Added
//5 Header Columns Added
//End Row

//Cell ColSpan as 5 and text center
builder.InsertCell().FirstParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(250 * 5);

builder.Write(“No Records found.”);
builder.EndRow();

@stram,

Please try using the following code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.InsertCell();
builder.CellFormat.HorizontalMerge = CellMerge.First;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write("Text in merged cells.");

builder.InsertCell();
// This cell is merged to the previous and should be empty.
builder.CellFormat.HorizontalMerge = CellMerge.Previous;

builder.InsertCell();
// This cell is merged to the previous and should be empty.
builder.CellFormat.HorizontalMerge = CellMerge.Previous;

builder.InsertCell();
// This cell is merged to the previous and should be empty.
builder.CellFormat.HorizontalMerge = CellMerge.Previous;

builder.InsertCell();
// This cell is merged to the previous and should be empty.
builder.CellFormat.HorizontalMerge = CellMerge.Previous;

builder.EndRow();

builder.InsertCell();
builder.ParagraphFormat.ClearFormatting();
builder.CellFormat.HorizontalMerge = CellMerge.None;
builder.Write("Text in one cell.");

builder.InsertCell();
builder.Write("Text in another cell.");

builder.InsertCell();
builder.Write("Text in another cell.");

builder.InsertCell();
builder.Write("Text in another cell.");

builder.InsertCell();
builder.Write("Text in another cell.");

builder.EndRow();
builder.EndTable();

doc.Save("D:\\Temp\\18.6.docx");