gpt4 book ai didi

python - OpenOffice pyuno "select all"

转载 作者:太空狗 更新时间:2023-10-30 01:17:21 31 4
gpt4 key购买 nike

有谁知道如何使用 OO uno bridge api 在 Calc 工作表中“全选”?

或者,找到最大使用行数和列数也可以。

我想要做的是对电子表格中的所有单元格应用一种格式。

(原因是我将工作表保存为 csv,因此除非格式提供足够的小数位,否则无法准确保存数字。)

最佳答案

假设您已经连接到 OpenOffice,并且 document 是一个已打开或创建的电子表格。

#get the sheet you want to work with, I'm just going to grab the first sheet
sheets = document.getSheets().createEnumeration()
sheet = sheets.nextElement()

#start with a range on the first cell
range = sheet.getCellRangeByPosition( 0, 0, 0, 0 )

#expand to full extend of the used area
range.gotoEndOfUsedArea( True ) #true for expand selection

#no do whatever formatting things you want to do

关于python - OpenOffice pyuno "select all",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4974763/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com