Libre Office Pythhon 매크로를 사용하여 Writer에 스프레드시트 바람 테이블 만들기
8524 단어 LibreOfficePython
Ubuntu Stdio 17.10
LibreOffice 6.0
Apache OpenOffice 홈 페이지에는 유용한 정보와 샘플이 많이 있습니다.
이번에도 찾고 있는 정보는 아니지만 모르는 정보가 많다.
홈페이지 상단에서 찾아도 찾을 수 없기 때문에'아파치 Open Office pythhon'등으로 검색하면 인기다.
Writer에서 스프레드시트 바람의 테이블 작성
지금까지 Writer의 표에서 공식을 사용할 수 있는지 몰랐지만 수동으로 표 명령에 공식을 넣어도 잘 계산할 수 있었다.
하지만,Calc만큼 사용하기 쉽지 않아요.
또 모든 함수를 다 사용할 수 있는 것은 아닌 것 같다.
= <A1>+
Writer_Cell.py
#import uno #不要
#import unohelper #不要
def InsertCell():
doc = XSCRIPTCONTEXT.getDocument()
text = doc.Text
cursor = text.createTextCursor()
table = doc.createInstance( "com.sun.star.text.TextTable" )
table.initialize( 5,4) #(行数,列数)
text.insertTextContent( cursor, table, 0 ) #表を作成
table.getCellByName("A1").createTextCursor().setPropertyValue( "CharColor", 3710932 ) #textColor
table.getCellByName("A1").setPropertyValue( "BackColor", 13421823 ) #BackColor
table.getCellByName("A1").setString("都道府県")
table.getCellByName("B1").setString("男人口")
table.getCellByName("C1").setString("女人口")
table.getCellByName("D1").setString("小計")
table.getCellByName("A2").setString("大阪府")
table.getCellByName("B2").setValue(10000)
table.getCellByName("C2").setValue(10000)
table.getCellByName("D2").setFormula("sum <B2:C2>")
table.getCellByName("A3").setString("京都府")
table.getCellByName("B3").setValue(9000)
table.getCellByName("C3").setValue(9000)
table.getCellByName("D3").setFormula("sum <B3:C3>")
table.getCellByName("A4").setString("奈良県")
table.getCellByName("B4").setValue(8000)
table.getCellByName("C4").setValue(8000)
table.getCellByName("D4").setFormula("sum <B4:C4>")
table.getCellByName("C5").setString("合計")
table.getCellByName("D5").setFormula("sum <D2:D4>")
'A1'단원의 컬러 코드는'13421823'과 10진수로 이해하기 어려워'0xCCFF'처럼 16진법으로 이해하기 쉽다.아래 표에는 지정된 색상이 없습니다.
PyUNO samples
https://wiki.openoffice.org/wiki/PyUNO_samples
Reference
이 문제에 관하여(Libre Office Pythhon 매크로를 사용하여 Writer에 스프레드시트 바람 테이블 만들기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/ty21ky/items/274a4efda833a352f374텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)