PreferredWidthType

Inheritance: java.lang.Object

public class PreferredWidthType

Specifies the unit of measurement for the preferred width of a table or cell.

Examples:

Shows how to verify the preferred width type and value of a table cell.


 Document doc = new Document(getMyDir() + "Tables.docx");

 Table table = doc.getFirstSection().getBody().getTables().get(0);
 Cell firstCell = table.getFirstRow().getFirstCell();

 Assert.assertEquals(PreferredWidthType.PERCENT, firstCell.getCellFormat().getPreferredWidth().getType());
 Assert.assertEquals(11.16d, firstCell.getCellFormat().getPreferredWidth().getValue());
 

Fields

FieldDescription
AUTOThe preferred width is not specified.
PERCENTMeasure the current item width using a specified percentage.
POINTSMeasure the current item width using a specified number of points (1/72 inch).
length

Methods

MethodDescription
fromName(String preferredWidthTypeName)
getName(int preferredWidthType)
getValues()
toString(int preferredWidthType)

AUTO

public static int AUTO

The preferred width is not specified. The actual width of the table or cell is either specified using the explicit width or will be determined automatically by the table layout algorithm when the table is displayed, depending on the table auto fit setting.

PERCENT

public static int PERCENT

Measure the current item width using a specified percentage.

POINTS

public static int POINTS

Measure the current item width using a specified number of points (1/72 inch).

length

public static int length

fromName(String preferredWidthTypeName)

public static int fromName(String preferredWidthTypeName)

Parameters:

ParameterTypeDescription
preferredWidthTypeNamejava.lang.String

Returns: int

getName(int preferredWidthType)

public static String getName(int preferredWidthType)

Parameters:

ParameterTypeDescription
preferredWidthTypeint

Returns: java.lang.String

getValues()

public static int[] getValues()

Returns: int[]

toString(int preferredWidthType)

public static String toString(int preferredWidthType)

Parameters:

ParameterTypeDescription
preferredWidthTypeint

Returns: java.lang.String