Спецскрипт для отписывания в utf-8

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
doc = XSCRIPTCONTEXT.getDocument()
sheet = doc.getCurrentController().ActiveSheet
def csv_save( param ):
i = 0
fout = open("d:\\work\\oo\\test.csv","wt")
while 1:
phrase = sheet.getCellByPosition(0,i).getFormula()
syno = sheet.getCellByPosition(1,i).getFormula()
weight = sheet.getCellByPosition(2,i).getValue()
if not len(phrase): break;
egg = "\"%s\";\"%s\";%i\n" % (phrase, syno, weight)
fout.write( egg.encode("utf-8") )
i+=1
fout.close()