/ / Wie formatiere ich die Tabelle in aspose nach der Generierung richtig? - Java, aspose, aspose.words

Wie formatiere ich die Tabelle nach der Generierung richtig? - java, aspose, aspose.words

Gibt es eine Möglichkeit, wie ich nach dem Generieren einer Tabelle in aspose Word eine benutzerdefinierte Formatierung durch den Code anwenden kann?

Antworten:

0 für die Antwort № 1

Sie können auf die gewünschte Tabelle des Word-Dokuments und zugreifen Formatierung auf Tabelle, Zeile und Zelle anwenden. Bitte überprüfen Sie den folgenden Codeausschnitt, um die erste Tabelle des Dokuments zu formatieren.

Ich arbeite mit Aspose als Entwickler Evangelist.

com.aspose.words.Document doc = new com.aspose.words.Document("input.doc");
com.aspose.words.Table table = (com.aspose.words.Table) doc.getChild(NodeType.TABLE, 0, true);

// Align the table to the center of the page.
table.setAlignment(TableAlignment.CENTER);

// Clear any existing borders from the table.
table.clearBorders();

// Set a green border around the table but not inside.
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("Table.SetOutlineBorders_Out.doc");