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

Free Support Forum - aspose.com

Docx format doesn't support 63 cells or more within a row

I understand MS Word doesn’t support creating more than 63 cells within a row.


Below code throws such exception. My question would be is there any sort of things to overcome this exception since it doesn’t allow to generate output document.

Document wordDoc = new Document();

if (wordDoc != null)
{
wordDoc.RemoveAllChildren();
}

Section CurrentSection = new Section(wordDoc);
CurrentSection.AppendChild(new Body(wordDoc));
wordDoc.Sections.Add(CurrentSection);

Table currentTable = new Table(wordDoc);
CurrentSection.Body.AppendChild(currentTable);
Row currentTableRow = new Row(wordDoc);
currentTable.AppendChild(currentTableRow);

for (int i = 0; i <= 63; i++)
{
Cell currentCell = new Cell(wordDoc);
currentTableRow.AppendChild(currentCell);
}

Paragraph ph = new Paragraph(wordDoc);
Run rn = new Run(wordDoc, “Testing whether docx is generated”);
ph.AppendChild(rn);
wordDoc.Save(“Output_Table.docx”, SaveFormat.Docx);
Hi Manikandan,

Thanks for your inquiry. You are creating the document programmatically. So, please do not add cells more than 62 in a row. You may iterate over table's rows before saving the document and check if any row contains cells more than 62.

Please let us know if you have any more queries.