2013-02-26 5 views
1

필자는 LibreOffice.calc에 액세스하고, 파일을 열고, 내 시트와 getValue() 및 getFormula()를 선택했습니다. 즉, 내 직업은 (거의) 완료되었지만 PyUno 브리지는 다리와 매우 Pythonic하지 않습니다.PyUno Bridge 객체 모델이 있습니까?

예를 들어

, for sheet in sheets:는 다음과 같은 예외가 발생합니다 : TypeError: 'pyuno' object is not iterable

그래서, 질문은 만약 누군가가, 어딘가에있는 LibreOffice와 (CALC) 개체 모델에 오픈 소스 파이썬 라이브러리?

off = LibreOffice() 
calc = off.Open(file) 
sheets = calc.getSheets() 
for sheet in sheets: 
    print(sheet.name) 
    rng = sheet.Range("A1:C5") 
... 

답변

0

아직 그런 것은 없습니다. 나는 그런 일을 실험 해왔다. 일은 여기에있다. 내 접근 방식은 doxygen 출력을 가져 와서 코드 생성기에 입력으로 사용하여 래퍼 클래스 세트를 만든 다음 테스트 프레임을 위해 Python으로 구현할 수도있었습니다. 여기

0

는 대신 했어야 것입니다 :

sheets = calc.getSheets() 
sheet_names = sheets.getElementNames() 

for sheet_name in sheet_names: 
    print(sheet_name) 
    sheet = sheets.getByName(sheet_name) 

코드가 거짓말을 doesen't : D

+0

내 코드를 다시 방문이 작동하는지 볼 수 있습니다 ... –