#!/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()