OpenOffice pyuno“全选" [英] OpenOffice pyuno "select all"

查看:192
本文介绍了OpenOffice pyuno“全选"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何使用OO uno桥api在Calc工作表中全选"吗?

Does anyone know how to use the OO uno bridge api to "select all" in a Calc sheet?

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

Alternatively, finding the maximum used row and column number would work.

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

What I want to do is apply a format to all the cells in the spreadsheet.

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

(The reason being that I'm saving the sheet as csv, so numbers are not accurately saved unless the format provides enough decimal places.)

推荐答案

假定您已经连接到OpenOffice,并且document是已打开或创建的电子表格.

Assuming you have already connected to OpenOffice and document is a spreadsheet that has been opened or created.

#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

这篇关于OpenOffice pyuno“全选"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆