Пример #1
0

if __name__ == "__main__":

    from sodsspreadsheet import SodsSpreadSheet

    t = SodsSpreadSheet(12, 12)

    print "Test spreadsheet naming:"
    print "-----------------------"

    t.setStyle("A1", text="שלום עולם")
    t.setStyle("A1:G2", background_color="#00ff00")
    t.setStyle("A3:G5", background_color="#ffff00")

    t.setValue("A2", 123.4)
    t.setValue("B2", "2010-01-01")
    t.setValue("C2", "0.6")

    t.setValue("C5", 0.6)
    t.setValue("C6", 0.6)
    t.setValue("C7", 0.8)
    t.setValue("C8", 0.8)
    t.setValue("C9", "=AVERAGE(C5:C8)")
    t.setValue("C10", "=SUM(C5:C8)")

    t.setValue("D2", "= SIN(PI()/2)")
    t.setValue("D10", "=IF(A2>3;C7;C9)")

    t.setStyle("A3:D3", border_top="1pt solid #ff0000")
    t.setValue("C3", "Sum of cells:")
Пример #2
0
      file(filename,"w").write(self.exportCsv(i_max, j_max, delimiter, txt_delimiter))

if __name__ == "__main__":

  from sodsspreadsheet import SodsSpreadSheet

  t = SodsSpreadSheet()

  print "Test spreadsheet naming:"
  print "-----------------------"

  t.setStyle("A1", text = "Simple ods python")
  t.setStyle("A1:G2", background_color = "#00ff00")
  t.setStyle("A3:G5", background_color = "#ffff00")

  t.setValue("A2", 123.4)
  t.setValue("B2", "2010-01-01")
  t.setValue("C2", "=0.6")
  t.setValue("D2", "= A2 + 3")

  t.setStyle("A3:D3", border_top = "1pt solid #ff0000")
  t.setValue("C3", "Sum of cells:")
  t.setValue("D3", "=sum(A2:D2)")

  t.setStyle("D2:D3", condition = "cell-content()<=200")
  t.setStyle("D2:D3", condition_color = "#ff0000")

  tw = SodsCsv(t)
  tw.save("test.csv")