加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – OpenOffice pyuno“全选”

发布时间:2020-12-16 22:19:01 所属栏目:Python 来源:网络整理
导读:有谁知道如何使用OO uno bridge api在Calc表中“全

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

或者,找到最大使用的行和列号将起作用.

我想要做的是将格式应用于电子表格中的所有单元格.

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

最佳答案
假设您已连接到OpenOffice,文档是已打开或创建的电子表格.

#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 )

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

#no do whatever formatting things you want to do

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读