예제 #1
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)
예제 #2
0
# 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")

# conditional styles
t.setStyle("B1:B5", condition="cell-content()<=125")
t.setStyle("B1:B5", condition_color="#ff0000")
예제 #3
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")
예제 #4
0
파일: vcfToRqtl.py 프로젝트: Linhua-Sun/RIG
    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")

if bool_keepSDCO == False:
    str_outFile = (str_vcfName.split(".")[0]) + "_noSDCO.ods"
else:
    str_outFile = (str_vcfName.split(".")[0]) + ".ods"

sys.stderr.write("Outputting %s markers to .ods\n" % str(rowsOutput - 1))
Sods_ods = SodsOds(Sods_table)
Sods_ods.save(str_outFile)
예제 #5
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")

예제 #6
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")

예제 #7
0
# 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")

# conditional styles
t.setStyle("B1:B5", condition = "cell-content()<=125")
t.setStyle("B1:B5", condition_color = "#ff0000")

# export
예제 #8
0
        exit(1)

# produce ODS file for timetable
Sods_ods = SodsOds(spreadsheet_timetable)
Sods_ods.save(output_file)

# produce ODS file for comparison of input and output
with open(input_file, newline='') as csvfile_input:
    spamreader = csv.reader(csvfile_input, delimiter=',', quotechar='"')

    first_line = True
    for i, row in enumerate(spamreader):
        if first_line:
            # copy the table header
            print_row(spreadsheet_output_comparison, i+1, row)
            spreadsheet_output_comparison.setValue(cell_coordinate(i+1, output_comparison_col_name_vvz), "Name aus VVZ")
            spreadsheet_output_comparison.setValue(cell_coordinate(i+1, output_comparison_col_found_appointment), "Termin gefunden?")
            first_line = False
        else:
            print_row(spreadsheet_output_comparison, i+1, row)
            if int(row[0]) not in courses_missed and int(row[0]) not in courses:
                found_appointment = "…"
            elif int(row[0]) not in courses_missed:
                found_appointment = "ja"
            else:
                found_appointment = "nein"
            if found_appointment != "…":
                spreadsheet_output_comparison.setValue(cell_coordinate(i+1, output_comparison_col_name_vvz), courses[int(row[0])].name)
                spreadsheet_output_comparison.setValue(cell_coordinate(i+1, output_comparison_col_found_appointment), found_appointment)
                # color the cell if the name is different as this could be an issue
                if row[2] != courses[int(row[0])].name:
예제 #9
0
# 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)
tw.save("test.html", tip=True, headers=True)