Is there a way to create a word table with more than 15 columns using Novacode DocX?
If I create a new table with greater than 14 columns, the table doesn't appear. I can get around this by doing something like this:
int addCols = Math.Min(data.colCount, 14);
Table docTable = doc.InsertTable(data.rowCount, addCols);
And then later this:
docTable.InsertColumn();
However, if I try to do this more than once to create a table with 16 or more columns, I have the same issue where the table doesn't appear.
Is there any way around this?
Here is my way around this. This might not work if you need many different tables with random large numbers of columns because it would take a lot of work.
This is a possible solution.
templateis theDocXyou are inserting aTableinto.template2contains pre-madeTablesthat are 1 row and have as many columns as you would like. Sotemplate2.Table[0]would be aTablesize (1,15). You can then add moreTablestotemplate2(outside of code by creating them within the document in Microsoft Word) growing larger:template2.Table[1]would be aTablesize (1,16). The only issue is if you have a lot of different number of columnTablesthat you need to work with.Novacode-doxis not a very good library for building things from scratch.Hope this might be a work around for you.