Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在生成后正确地在aspose中重新格式化表?_Java_Aspose_Aspose.words - Fatal编程技术网

Java 如何在生成后正确地在aspose中重新格式化表?

Java 如何在生成后正确地在aspose中重新格式化表?,java,aspose,aspose.words,Java,Aspose,Aspose.words,在一个word中生成一个表后,有没有办法通过代码应用一些自定义格式?您可以访问所需的word文档表和文档。请检查以下代码段以格式化文档的第一个表 我与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.TA

在一个word中生成一个表后,有没有办法通过代码应用一些自定义格式?

您可以访问所需的word文档表和文档。请检查以下代码段以格式化文档的第一个表

我与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");

我测试了这种方法,对我来说,最好避免在java中添加样式,最好使用word文档。