有没有办法在aspose word中生成表后如何通过代码应用一些自定义格式化?
答案 0 :(得分:0)
您可以访问所需的Word文档表和apply formatting to Table,Row and Cell。请检查以下代码段以格式化文档的第一个表格。
我与Aspose一起担任开发人员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");