Fitting all Tables to the Page Width
Contents
[
Hide
]
VSTO
string mypath = "Document.docx";
Word.Application wordApp = Application;
wordApp.Documents.Open(mypath);
foreach (Table table in this.Application.ActiveDocument.Tables)
{
table.PreferredWidthType = WdPreferredWidthType.wdPreferredWidthPercent;
table.PreferredWidth = 100;
}
Aspose.Words
Document doc = new Document( "doc.docx");
foreach (Table table in doc.GetChildNodes(NodeType.Table, true))
{
table.PreferredWidth = PreferredWidth.FromPercent(100);
}