aspose wordでテーブルを生成した後、コードを介してカスタム書式設定を適用する方法はありますか?
回答:
回答№1は0Word文書の目的のテーブルにアクセスして、 表、行、およびセルに書式を適用します。次のコードスニペットを確認して、ドキュメントの最初のテーブルをフォーマットしてください。
私はAsposeで開発者エバンジェリストとして働いています。
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");