示例#1
0
	def 產生sods(self, 孤表, 欄 = 2, 換頁逝 = 15):
		表 = SodsSpreadSheet(len(孤表) + 1, len(孤表[-1]) * 欄 + 1)
		這馬逝 = 1
		for 一逝 in 孤表:
			for 所在 in range(len(一逝)):
				座標 = 表.encodeColName(所在 + 1) + str(這馬逝)
				表.setValue(座標, 一逝[所在])
				表.setStyle(座標,
					border_top = "1pt solid #000000",
					border_bottom = "1pt solid #000000",
					border_left = "1pt solid #000000",
					border_right = "1pt solid #000000",)
			這馬逝 += 1
		return 表
示例#2
0
#
# 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

t = SodsSpreadSheet(10, 10)

print("Test spreadsheet naming:")
print("-----------------------")

# setting values and formulas
t.setValue("A1", "Hello world !")

t.setValue("B2:C2", 123.4)
t.setValue("B3", "=B2+3")
t.setValue("B4", "=sum(B2:B3)")

# cell styles
t.setStyle("A1", color="#0000ff")
t.setStyle("A1:A5", background_color="#00ff00")
t.setStyle("B1:B5",
示例#3
0
#!/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)
示例#4
0
#####
#####
#Write to .ods:
#Adapted from http://stackoverflow.com/questions/181596/how-to-convert-a-column-number-eg-127-into-an-excel-column-eg-aa
def GetColumnName(int_columnNumber):
    int_dividend = int_columnNumber
    str_columnName = ""
    int_modulo = 0
    while (int_dividend > 0):
        int_modulo = (int_dividend - 1) % 26
        str_columnName = chr(65 + int_modulo) + str_columnName
        int_dividend = (int_dividend - int_modulo) / 26
    return str_columnName


Sods_table = SodsSpreadSheet(len(LILI_TABLE) + 1, len(LILI_TABLE[0]) + 1)

rowsOutput = 0
for rowIndex in range(len(LILI_TABLE)):
    rowsOutput = rowsOutput + 1
    for colIndex in range(len(LILI_TABLE[rowIndex])):
        str_coordinate = GetColumnName(colIndex + 1) + str(
            rowIndex + 1)  #Spreadsheet is not 0 based.
        Sods_table.setValue(str_coordinate,
                            str(LILI_TABLE[rowIndex][colIndex]))
        if LILI_TABLE[rowIndex][colIndex] == "aa":
            Sods_table.setStyle(str_coordinate, background_color="#33ff33")
        elif LILI_TABLE[rowIndex][colIndex] == "bb":
            Sods_table.setStyle(str_coordinate, background_color="#3399ff")
        elif LILI_TABLE[rowIndex][colIndex] == "ab":
            Sods_table.setStyle(str_coordinate, background_color="#00ffff")
示例#5
0
# 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")
示例#6
0
# 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) <*****@*****.**>

import sys
import urllib.request, urllib.parse, urllib.error
import getopt
from urllib.parse import unquote
from http.server import BaseHTTPRequestHandler, HTTPServer

from simpleodspy.sodsspreadsheet import SodsSpreadSheet
from simpleodspy.sodshtml import SodsHtml

t = SodsSpreadSheet(16,8)
	
class HttpHandler(BaseHTTPRequestHandler):
	
	def log_message(self, format, *args):
		pass
	
	def parse_Path(self):
		full_path = self.path.strip('/').split('?')
		self.clean_path = full_path[0]
		
		self.parameters = {}
		
		if len(full_path) == 2:
			for arg in full_path[1].split('&'):
				arg_t = arg.split('=')
示例#7
0
# 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")

示例#8
0
# 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")

示例#9
0
#
# 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

t = SodsSpreadSheet(10, 10)
	
print("Test spreadsheet naming:")
print("-----------------------")

# setting values and formulas
t.setValue("A1", "Hello world !")

t.setValue("B2:C2", 123.4)
t.setValue("B3", "=B2+3")
t.setValue("B4", "=sum(B2:B3)")

# cell styles
t.setStyle("A1", color = "#0000ff")
t.setStyle("A1:A5", background_color = "#00ff00")
t.setStyle("B1:B5", border_left = "1pt solid #ff0000", background_color = "#ffff00")
示例#10
0
font_family = "Liberation Sans"
font_size_name = "12pt"
font_size = "10pt"
font_size_header = "20pt"

block_separator_border = "2pt solid #000000"
block_separator_appointments = "1pt solid #000000"

###
# End of configuration options
###

# rows, columns
# TODO: change everything to row, column
spreadsheet_timetable = SodsSpreadSheet(200, 20)

output_comparison_col_exclude = 4
output_comparison_col_uebung = 5
output_comparison_col_praktikum = 6
output_comparison_col_found_appointment = 7
output_comparison_col_name_vvz = 8

class Course:

    def __init__(self, id, lvnr, name, lecturers):
        self.id = int(id)
        self.lvnr = int(lvnr)
        self.name = name
        self.name_short = ""
        self.category = ""
示例#11
0
# 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("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)