pyuno
                Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| pyuno [2010/07/21 01:20] – created suapapa | pyuno [2013/08/03 05:04] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| 오픈오피스 파이썬확장 수련 | 오픈오피스 파이썬확장 수련 | ||
| - | + | ====== install ====== | |
| - | 오픈오피스는 아래 위치에 설치되어 있음 | + | 다음 패키지 설지: | 
| + | <code bash> | ||
| + | $ sudo apt-get install python-uno | ||
| + | </ | ||
| + | 오픈오피스는 아래 위치에 설치되어 있음: | ||
| < | < | ||
| / | / | ||
| Line 9: | Line 13: | ||
| $ sudo ldconfig -v / | $ sudo ldconfig -v / | ||
| </ | </ | ||
| + | |||
| + | ====== hello world ====== | ||
| + | 우선 오픈오피스를 다음처럼 실행 | ||
| + | <code bash> | ||
| + | soffice " | ||
| + | </ | ||
| + | 다음으로 아래의 코드 실행 | ||
| + | <code python> | ||
| + | # | ||
| + | # -*- coding: utf-8 -*- | ||
| + | |||
| + | import uno | ||
| + | |||
| + | localContext = uno.getComponentContext() | ||
| + | resolver = localContext.ServiceManager.createInstanceWithContext( | ||
| + | " | ||
| + | ctx = resolver.resolve( " | ||
| + | smgr = ctx.ServiceManager | ||
| + | desktop = smgr.createInstanceWithContext( " | ||
| + | model = desktop.getCurrentComponent() | ||
| + | text = model.Text | ||
| + | cursor = text.createTextCursor() | ||
| + | text.insertString( cursor, " | ||
| + | |||
| + | ctx.ServiceManager | ||
| + | </ | ||
| + | ====== ooclac ====== | ||
| + | 그냥 ooclac 실행하고 해도 되나?? | ||
| + | <code python> | ||
| + | # | ||
| + | |||
| + | import uno | ||
| + | localContext = uno.getComponentContext() | ||
| + | resolver = localContext.ServiceManager.createInstanceWithContext(" | ||
| + | ctx = resolver.resolve( " | ||
| + | smgr = ctx.ServiceManager | ||
| + | desktop = smgr.createInstanceWithContext( " | ||
| + | oDoc = desktop.getCurrentComponent() | ||
| + | |||
| + | # sheet to be activated | ||
| + | oSheet = oDoc.getSheets().getByIndex(2) | ||
| + | |||
| + | # activate the sheet | ||
| + | oController = oDoc.getCurrentController() | ||
| + | oController.setActiveSheet(oSheet) | ||
| + | |||
| + | # set first visible row | ||
| + | oController.setFirstVisibleRow(3) | ||
| + | </ | ||
| + | |||
| + | ====== ooimpress ====== | ||
| + | UNO service : com.sun.star.presentation.SlideShow | ||
| + | *[[http:// | ||
| + | *[[http:// | ||
| + | *[[http:// | ||
| ====== references ====== | ====== references ====== | ||
| + | *[[http:// | ||
| *[[http:// | *[[http:// | ||
| + | *[[http:// | ||
| + | *[[http:// | ||
| + | *[[http:// | ||
pyuno.1279675245.txt.gz · Last modified: 2013/08/03 05:04 (external edit)
                
                