aspose.word JAVA 关闭autofit
时间: 2023-10-17 19:13:05 浏览: 149
要关闭Aspose.Words中表格单元格自动调整大小的功能,可以使用以下代码:
```
Document doc = new Document("input.docx");
// 获取文档中所有表格
NodeCollection tables = doc.getChildNodes(NodeType.TABLE, true);
// 遍历所有表格
for (Table table : (Iterable<Table>) tables) {
// 获取表格中所有行
for (Row row : table.getRows()) {
// 获取行中所有单元格
for (Cell cell : row.getCells()) {
// 关闭单元格宽度自动调整
cell.getCellFormat().setFitText(false);
}
}
}
doc.save("output.docx");
```
该代码遍历文档中的所有表格,然后遍历每个表格中的所有单元格,并将每个单元格的自动调整宽度设置为false。最后保存文档。
相关问题
aspose.word14.9.0 java 设置宽度不自动调整
如果您要使用Aspose.Words的14.9.0版本,可以使用以下代码来设置表格单元格宽度不自动调整:
```
Document doc = new Document("input.docx");
// 获取文档中所有表格
NodeCollection tables = doc.getChildNodes(NodeType.TABLE, true);
// 遍历所有表格
for (Table table : (Iterable<Table>) tables) {
// 获取表格中所有行
for (Row row : table.getRows()) {
// 获取行中所有单元格
for (Cell cell : row.getCells()) {
// 设置单元格宽度不自动调整
cell.getCellFormat().setFitText(false);
// 设置单元格宽度固定
double width = 100.0; // 设置单元格宽度
cell.getCellFormat().setWidth(ConvertUtil.pixelToPoint((float) width));
}
}
}
doc.save("output.docx");
```
该代码遍历文档中的所有表格,然后遍历每个表格中的所有单元格,并将每个单元格的自动调整宽度设置为false。同时设置单元格的宽度为固定值。最后保存文档。
aspose.word for java 23
aspose.word for java 23是一款基于Java平台的文档处理和生成库。它支持各种文档格式的创建、编辑和转换,包括DOCX、DOC、RTF、XML、HTML、PDF等。这个版本的更新主要包括性能优化、bug修复和新功能添加。在性能方面,aspose.word for java 23加入了一些优化算法和技术,提高了文档处理和转换的速度,同时减少了内存占用。在bug修复方面,开发团队对用户反馈的问题进行了及时修复,提高了产品的稳定性和可靠性。在新功能方面,aspose.word for java 23增加了一些新的API和特性,使用户可以更加方便地对文档进行操作和修改。例如,新增了对更多文档元素的支持,包括表格、图表、图片等,同时还增加了更丰富的格式设置和样式处理功能。总的来说,aspose.word for java 23是一款功能强大、性能优秀的文档处理库,可以帮助开发人员在Java应用中轻松实现各种文档处理需求,提高工作效率,节省时间成本。
阅读全文
相关推荐
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)