public class TextureIndex
extends java.lang.Object
Examples:
Shows how to apply an outline border to a table.
Document doc = new Document(getMyDir() + "Tables.docx");
Table table = doc.getFirstSection().getBody().getTables().get(0);
// Align the table to the center of the page.
table.setAlignment(TableAlignment.CENTER);
// Clear any existing borders and shading from the table.
table.clearBorders();
table.clearShading();
// Add green borders to the outline of the table.
table.setBorder(BorderType.LEFT, LineStyle.SINGLE, 1.5, Color.GREEN, true);
table.setBorder(BorderType.RIGHT, LineStyle.SINGLE, 1.5, Color.GREEN, true);
table.setBorder(BorderType.TOP, LineStyle.SINGLE, 1.5, Color.GREEN, true);
table.setBorder(BorderType.BOTTOM, LineStyle.SINGLE, 1.5, Color.GREEN, true);
// Fill the cells with a light green solid color.
table.setShading(TextureIndex.TEXTURE_SOLID, Color.GREEN, Color.GREEN);
doc.save(getArtifactsDir() + "Table.SetOutlineBorders.docx");
Shows how to decorate text with borders and shading.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
BorderCollection borders = builder.getParagraphFormat().getBorders();
borders.setDistanceFromText(20.0);
borders.getByBorderType(BorderType.LEFT).setLineStyle(LineStyle.DOUBLE);
borders.getByBorderType(BorderType.RIGHT).setLineStyle(LineStyle.DOUBLE);
borders.getByBorderType(BorderType.TOP).setLineStyle(LineStyle.DOUBLE);
borders.getByBorderType(BorderType.BOTTOM).setLineStyle(LineStyle.DOUBLE);
Shading shading = builder.getParagraphFormat().getShading();
shading.setTexture(TextureIndex.TEXTURE_DIAGONAL_CROSS);
shading.setBackgroundPatternColor(new Color(240, 128, 128)); // Light Coral
shading.setForegroundPatternColor(new Color(255, 160, 122)); // Light Salmon
builder.write("This paragraph is formatted with a double border and shading.");
doc.save(getArtifactsDir() + "DocumentBuilder.ApplyBordersAndShading.docx");
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String textureIndexName) |
static java.lang.String |
getName(int textureIndex) |
static int[] |
getValues() |
static java.lang.String |
toString(int textureIndex) |
public static int TEXTURE_10_PERCENT
public static int TEXTURE_12_PT_5_PERCENT
public static int TEXTURE_15_PERCENT
public static int TEXTURE_17_PT_5_PERCENT
public static int TEXTURE_20_PERCENT
public static int TEXTURE_22_PT_5_PERCENT
public static int TEXTURE_25_PERCENT
public static int TEXTURE_27_PT_5_PERCENT
public static int TEXTURE_2_PT_5_PERCENT
public static int TEXTURE_30_PERCENT
public static int TEXTURE_32_PT_5_PERCENT
public static int TEXTURE_35_PERCENT
public static int TEXTURE_37_PT_5_PERCENT
public static int TEXTURE_40_PERCENT
public static int TEXTURE_42_PT_5_PERCENT
public static int TEXTURE_45_PERCENT
public static int TEXTURE_47_PT_5_PERCENT
public static int TEXTURE_50_PERCENT
public static int TEXTURE_52_PT_5_PERCENT
public static int TEXTURE_55_PERCENT
public static int TEXTURE_57_PT_5_PERCENT
public static int TEXTURE_5_PERCENT
public static int TEXTURE_60_PERCENT
public static int TEXTURE_62_PT_5_PERCENT
public static int TEXTURE_65_PERCENT
public static int TEXTURE_67_PT_5_PERCENT
public static int TEXTURE_70_PERCENT
public static int TEXTURE_72_PT_5_PERCENT
public static int TEXTURE_75_PERCENT
public static int TEXTURE_77_PT_5_PERCENT
public static int TEXTURE_7_PT_5_PERCENT
public static int TEXTURE_80_PERCENT
public static int TEXTURE_82_PT_5_PERCENT
public static int TEXTURE_85_PERCENT
public static int TEXTURE_87_PT_5_PERCENT
public static int TEXTURE_90_PERCENT
public static int TEXTURE_92_PT_5_PERCENT
public static int TEXTURE_95_PERCENT
public static int TEXTURE_97_PT_5_PERCENT
public static int TEXTURE_CROSS
public static int TEXTURE_DARK_CROSS
public static int TEXTURE_DARK_DIAGONAL_CROSS
public static int TEXTURE_DARK_DIAGONAL_DOWN
public static int TEXTURE_DARK_DIAGONAL_UP
public static int TEXTURE_DARK_HORIZONTAL
public static int TEXTURE_DARK_VERTICAL
public static int TEXTURE_DIAGONAL_CROSS
public static int TEXTURE_DIAGONAL_DOWN
public static int TEXTURE_DIAGONAL_UP
public static int TEXTURE_HORIZONTAL
public static int TEXTURE_NONE
public static int TEXTURE_SOLID
public static int TEXTURE_VERTICAL
public static int TEXTURE_NIL
public static int length