TablePreferredWidth Property

Gets or sets the table preferred width.

Namespace:  Aspose.Words.Tables
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.8.0

Syntax

public PreferredWidth PreferredWidth { get; set; }

Property Value

Type: PreferredWidth

Remarks

The default value is Auto.

Examples

Shows how to set a table to auto fit to 50% of the page width.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert a table with a width that takes up half the page width
Table table = builder.StartTable();

// Insert a few cells
builder.InsertCell();
table.PreferredWidth = PreferredWidth.FromPercent(50);
builder.Writeln("Cell #1");

builder.InsertCell();
builder.Writeln("Cell #2");

builder.InsertCell();
builder.Writeln("Cell #3");

doc.Save(ArtifactsDir + "DocumentBuilder.InsertTableWithPreferredWidth.docx");

See Also