Bedingte Formatierung

Programmierung unter AOO/LO (StarBasic, Python, Java, ...)

Moderator: Moderatoren

erikafuchs
******
Beiträge: 690
Registriert: Di, 13.02.2007 17:38
Wohnort: Büttelborn

Bedingte Formatierung

Beitrag von erikafuchs »

Hallo Leute,
vor einiger Zeit habt ihr mir geholfen in, per Makro erzeugten Dateien, Felder mit einer bedingten Formatierung zu versehen, die dafür sorgt dass sich die Felder grün färben wenn man eine Zahl eingibt. Ich habe hier die entsprechenden Teile des Codes mal eingefügt:

Code: Alles auswählen

Sub bedingteFormatierung_neu
   oPseudoCell = "A1"
   oCell = outSheet.getcellRangebyName(oPseudoCell)
   oCell.value = 1
   oCell.cellbackcolor = 4057917
   LDat.CurrentController.Select(oCell)
   oDoc=zielFrame
   dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
   dim args1(1) as new com.sun.star.beans.PropertyValue
   args1(0).Name = "Param"
   args1(0).Value = "1"
   args1(1).Name = "Family"
   args1(1).Value = 2
   dispatcher.executeDispatch(oDoc, ".uno:StyleNewByExample", "", 0, args1())   
   LDat.CurrentController.Select(-1)
   Zellformat(0).Name = "Operator"
   Zellformat(0).value = com.sun.star.sheet.ConditionOperator.GREATER_EQUAL
   Zellformat(1).Name = "Formula1"
   Zellformat(2).Name = "StyleName"
end sub

sub bedingteFormatierung (Spalte, StartZeile, EndZeile)
   for ze = StartZeile to EndZeile
      BedingtFormat = outSheet.getcellbyPosition(Spalte,ze).ConditionalFormat
      ocell2 = outSheet.getcellRangebyName(oPseudoCell).string
      Zellformat(1).value = ocell2
      Zellformat(2).value = ocell2
      BedingtFormat.addNew(Zellformat())
      outSheet.getcellbyPosition(Spalte,ze).ConditionalFormat = BedingtFormat
   next ze
end sub
... jetzt versuche ich den Code so zu verändern dass sich die Felder grün färben wenn ein Text eingetragen wird ...Es klappt nicht! Kann mir jemand sagen was ich ändern muss?
Vielen Dank
Pit