10

Open a Word (2007/2010) document that has a table in it, select the table and right click, select AutoFit-->AutoFit to Window

How can I implement this action in C# using the OpenXML SDK 2.5?

yazanpro
  • 4,512
  • 6
  • 44
  • 66

1 Answers1

20

You can set the width of the table to 100% of the page, or 5000 fiftieths-of-a-percent.

Table table = ...

TableWidth width = table.GetDescendents<TableWidth>().First();
width.Width = "5000";
width.Type = TableWidthUnitValues.Pct;
Rubixus
  • 757
  • 4
  • 11