如何通过 self.cell_sheet.cells.columns[0]获取该列指定的第二个单元格对象
另外render_row: Row = self.cell_sheet.cells.rows[row], 如何优雅地从Row对象中截断出一个Range对象
你可以根据Column得到列的索引,然后再根据需求指定行索引,通过Cells.get方法来获取需要的单元格。请参考以下API文档。
https://reference.aspose.com/cells/python-net/aspose.cells/cells/get/#int-int
通过Row对象得到行索引后,使用Cells.create_range方法构建Range对象。请参考以下API文档。
https://reference.aspose.com/cells/python-net/aspose.cells/cells/create_range/
我的意思:是否可以通过直接操作Row对象或Column对象, 直接获取指定的单元格或区域, 而不是通过操作self.cell_sheet.cells
@zengweiyu
如果是Row对象,你可以使用Row. get_cell_or_null和Row.get_cell_by_index方法获取单元格。Row和Column是不能直接创建范围的。请参考以下API文档。
https://reference.aspose.com/cells/python-net/aspose.cells/row/get_cell_or_null/#int
https://reference.aspose.com/cells/python-net/aspose.cells/row/get_cell_by_index/#int
Column对象有类似的方法吗
@zengweiyu
单元格在Cells模型中是按行存放的,所以您既可以通过Cells来访问单元格,也可以通过Row来访问。而Column是用于列的设置,如样式,宽度等,并不存放单元格数据,所以在Column上并没有访问单元格的方法。
@zengweiyu
请Cells.create_range方法构建整列的Range对象,和Range. getCellOrNull(int rowOffset, int columnOffset) method 或者迭代器来获取该列所有的单元格