0
我有一個python腳本,它成功地使用PyUNO在OpenOffice Writer文檔中進行搜索和替換。我想問如何獲得找到的文本的座標?如何用OpenOffice編寫器使用PyUNO獲取文本座標
import string
search = document.createSearchDescriptor()
search.SearchString = unicode('find')
#search.SearchCaseSensitive = True
#search.SearchWords = True
found = document.findFirst(search)
if found:
#log.debug('Found %s' % find)
## any code here help to get the coordinate of found text?
pass
你所說的「座標」意思? 文檔在文檔中的位置取決於頁面/字符大小和其他事實(屏幕/打印分辨率)。 你想用這樣的值做什麼? – ngulam
目的問題是我想在odt文件中添加一個'指定'文本,並檢測這個文本的頁面大小調整位置。 – Randy