t.setStyle("B1:B5", condition_color="#ff0000") # export from simpleodspy.sodsxml import SodsXml tw = SodsXml(t) tw.save("test.xml") # import t2 = SodsSpreadSheet(10, 10) tw = SodsXml(t2) tw.load("test.xml") tw.save("test2.xml") from simpleodspy.sodshtml import SodsHtml def myCallback(args): val = 0 for arg in t.rangeIterator(args): val += t.evaluateFormula(arg) * 2 return str(val) t.registerFunction('MY', myCallback) t.setValue("B5", "=MY(B2:B3)") tw = SodsHtml(t) tw.save("test.html")
t.setStyle("B1:B5", condition = "cell-content()<=125") t.setStyle("B1:B5", condition_color = "#ff0000") # export from simpleodspy.sodsxml import SodsXml tw = SodsXml(t) tw.save("test.xml") # import t2 = SodsSpreadSheet(10, 10) tw = SodsXml(t2) tw.load("test.xml") tw.save("test2.xml") from simpleodspy.sodshtml import SodsHtml def myCallback(args): val = 0 for arg in t.rangeIterator(args): val += t.evaluateFormula(arg) * 2 return str(val) t.registerFunction('MY', myCallback) t.setValue("B5", "=MY(B2:B3)") tw = SodsHtml(t) tw.save("test.html")
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Copyright (C) 2010 Yaacov Zamir (2010) <*****@*****.**> # Author: Yaacov Zamir (2010) <*****@*****.**> from simpleodspy.sodsspreadsheet import SodsSpreadSheet from simpleodspy.sodshtml import SodsHtml t = SodsSpreadSheet() def mul3Callback(arg): val = t.evaluateFormula(arg) * 3 return str(val) t.registerFunction('MUL3', mul3Callback) t.setValue("D2", 123.5) t.setValue("D3", "=3.0/5.0") t.setValue("D4", "=MUL3(D2+D3)") tw = SodsHtml(t) tw.save("test.html")
t.setStyle("B1:B5", condition_color="#ff0000") # export from simpleodspy.sodsxml import SodsXml tw = SodsXml(t) tw.save("test.xml") # import t2 = SodsSpreadSheet(10, 10) tw = SodsXml(t2) tw.load("test.xml") tw.save("test2.xml") from simpleodspy.sodshtml import SodsHtml def myCallback(args): val = 0 for arg in t.rangeIterator(args): val += t.evaluateFormula(arg) * 2 return str(val) t.registerFunction("MY", myCallback) t.setValue("B5", "=MY(B2:B3)") tw = SodsHtml(t) tw.save("test.html")