Sets the preferred width to the current table.
Name | Type | Default | Description |
sType | TableWidth | Type of the width value from one of the available width values types. |
|
nValue | number | null | The table width value measured in positive integers. |
builder.CreateFile("docx"); var oDocument = Api.GetDocument(); var oParagraph = oDocument.GetElement(0); oParagraph.AddText("We set the table cells to preserve their size:"); var oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table"); oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered")); var oTablePr = oTableStyle.GetTablePr(); var oTable = Api.CreateTable(3, 3); oTablePr.SetWidth("percent", 100); oTable.SetStyle(oTableStyle); oDocument.Push(oTable); builder.SaveFile("docx", "SetWidth.docx"); builder.CloseFile();