I'm looking for docx template engine for .NET with ability to generate tables with dynamic number of columns and merging cells in table. The main goal is to create source template document in Word then upload it to the server and then download documents generated on top of this template. Open source and commercial variants are welcome!

1 Answer 1


Syncfusion provides file parsing libraries for Word - Essential DocIO that can be used for creating documents from Word templates.

Example application

Essential DocIO Dynamic columns

//Loading existing word document.
        WordDocument document = new WordDocument();
        document.Open(dataPath + "Template.docx", FormatType.Automatic);
        //Add table in document.
        IWTable table = document.LastSection.AddTable();
        //Set rows and columns for table.
        table.ResetCells(rows, columns);

        //Apply horizontal merge for the specified cells of specified row.
        if (rowIndex != 0 && startCellIndex != 0 && endCellIndex != 0)
            table.ApplyHorizontalMerge(rowIndex - 1, startCellIndex - 1, endCellIndex - 1);

        //Apply vertical merge for the specified rows at the specified cell.
        if (columnIndex != 0 && startRowIndex != 0 && endRowIndex != 0)
            table.ApplyVerticalMerge(columnIndex - 1, startRowIndex - 1, endRowIndex - 1);

        //Saving the document.
        document.Save("Sample.docx", FormatType.Docx);
        //Message box confirmation to view the created document.
        if (MessageBoxAdv.Show("Do you want to view the generated Word document?", "Document has been created", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            //Launching the MS Word file using the default Application.[MS Word Or Free WordViewer]

The whole suite of controls and libraries is available for free through the community license program if you qualify (less than 1 million USD in revenue). Note: I work for Syncfusion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.