def do_GET(self): # get path self.parse_Path() # page headers self.send_response(200) self.send_header('Content-type', 'text/html') self.end_headers() # do table operations if 'cell' in list(self.parameters.keys()) and 'value' in list(self.parameters.keys()): cell = self.parameters['cell'] value = self.parameters['value'] if cell != "": t.setValue(self.parameters['cell'], self.parameters['value']) if 'cell' in list(self.parameters.keys()) and 'bgcolor' in list(self.parameters.keys()): cell = self.parameters['cell'] value = self.parameters['value'] if cell != "": t.setStyle(self.parameters['cell'], background_color = self.parameters['bgcolor']) # set form form_html = ''' <form> <table> <tr><td>Name</td><td><input type='text' name = 'cell' /></td></tr> <tr><td>Value</td><td><input type='text' name = 'value' /></td></tr> <tr><td>Bckground color</td><td><input type='text' name = 'bgcolor' /></td></tr> <tr><td></td><td><input type='submit' /></td></tr> </table> <form> ''' # print out page data tw = SodsHtml(t) print("<html><head>", file=self.wfile) print(tw.exportTableCss(), file=self.wfile) print("</head><body>", file=self.wfile) print(form_html, file=self.wfile) print(tw.exportTableHtml(headers = True), file=self.wfile) print("</body></html>", file=self.wfile) # finish page self.wfile.flush()
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")
#!/usr/bin/env python # -*- coding: utf-8 -*- from simpleodspy.sodsspreadsheet import SodsSpreadSheet from simpleodspy.sodshtml import SodsHtml t = SodsSpreadSheet() t.setValue("D2", 123.5) t.setValue("D3", "=3.0/5.0") t.setValue("D4", "=D2*3") t.setValue("D5", "=ABS(D3)") t.setValue("D6", "=SIN(PI * D3)") t.setValue("D7", "=SUM(D2:D6)") t.setValue("D8", "=IF(D3>D2;D6;D7)") t.setValue("D9", "=SUM(D2:D6)") t.setValue("A1", "=D7/D9") t.setValue("E3", "=hello,world") t.setValue("E4", "=CUT(E3,1)") tw = SodsHtml(t) tw.save("test.html", tip=True, headers=True)
# This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # 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() t.setValue("A1:A3", "green") t.setStyle("A1:A3", background_color="#00ff00") t.setValue("B1:B3", "blue") t.setStyle("B1:B3", background_color="#0000ff") t.setStyle("B3", border_top="1pt solid #ff0000", border_bottom="1pt solid #ff0000") tw = SodsHtml(t) tw.save("test.html")
# it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # 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() t.setValue("A1:A3", "green") t.setStyle("A1:A3", background_color = "#00ff00") t.setValue("B1:B3", "blue") t.setStyle("B1:B3", background_color = "#0000ff") t.setStyle("B3", border_top = "1pt solid #ff0000", border_bottom = "1pt solid #ff0000") tw = SodsHtml(t) tw.save("test.html")
def 產生html原始檔(self, 孤表, 欄 = 2, 換頁逝 = 15): 表 = self.產生sods(孤表, 欄, 換頁逝) 檔 = SodsHtml(表) return 檔.exportTableHtmlAndCss()
def 產生html(self, 孤表, 欄 = 2, 換頁逝 = 15): 表 = self.產生sods(孤表, 欄, 換頁逝) 檔 = SodsHtml(表) return 檔.exportHtml()
# 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() t.setValue("D2", 123.5) t.setValue("D3", "=3.0/5.0") t.setValue("D4", "=D2*3") t.setValue("D5", "=ABS(D3)") t.setValue("D6", "=SIN(PI * D3)") t.setValue("D7", "=SUM(D2:D6)") t.setValue("D8", "=IF(D3>D2;D6;D7)") t.setValue("D9", "=SUM(D2:D6)") t.setValue("A1", "=D7/D9") t.setValue("E3", "=hello,world") t.setValue("E4", "=CUT(E3,1)") tw = SodsHtml(t) tw.save("test.html", tip=True, headers=True)