マクロ 
Python マクロメモ
pw 
Calc の表を PukiWiki の表に。書式は無視されます。変換結果はクリップボードにコピーされます。OpenOffice.org を終了するとクリップボードの内容が削除されます。
mytools ライブラリが必要
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| | # -*- coding: utf_8 -*-
def pw_table():
sep = u'|'
doc = XSCRIPTCONTEXT.getDocument()
if doc.supportsService(u'com.sun.star.sheet.SpreadsheetDocument'):
s = doc.getCurrentSelection()
if s.supportsService(u'com.sun.star.sheet.SheetCellRange'):
a = s.getRangeAddress()
out = []
aout = out.append
line = []
for r in range(a.EndRow - a.StartRow +1):
line = []
for c in range(a.EndColumn - a.StartColumn +1):
line.append(s.getCellByPosition(c, r).getString())
aout(u''.join((sep, sep.join(line), sep)))
from mytools.transferable import copy_string
ctx = XSCRIPTCONTEXT.getComponentContext()
copy_string(ctx, u'\n'.join(out))
g_exportedScripts = pw_table,
|