🙏 Helfen Sie jetzt mit, unser LibreOffice Forum zu erhalten! 🙏
Mit Ihrer Spende sichern Sie den Fortbestand, den Ausbau und die laufenden Kosten dieses Forums. 🌱

🍀 Jeder Beitrag zählt – vielen Dank für Ihre Unterstützung!🍀

❤️ DANKE >> << DANKE ❤️

>> Dank Ihrer Unterstützung -> Keine Werbung für alle registrierten LibreOffice-Forum User! <<
🤗 Als Dankeschön werden Sie im Forum als LO-SUPPORTER gekennzeichnet. 🤗

Format einer Zelle (Calc) kopieren

Alles zur Programmierung im LibreOffice.
Antworten
weinbach
Beiträge: 27
Registriert: Di 14. Okt 2014, 15:51

Format einer Zelle (Calc) kopieren

Beitrag von weinbach » Di 21. Apr 2015, 11:41

Hallo,

bisher bin ich mit den Zelltypen EMPTY, VALUE, TEXT und FORMULA zurechtgekommen.
Jetzt möchte ich das Format einer Zelle (oder noch besser: Zellbereiches) kopieren.

Wie geht das?

Vielen Dannk

komma4
Beiträge: 185
Registriert: Sa 13. Aug 2011, 10:01
Wohnort: Chonburi Thailand Asia
Kontaktdaten:

Re: Format einer Zelle (Calc) kopieren

Beitrag von komma4 » So 31. Mai 2015, 21:30

weinbach hat geschrieben:Wie geht das?
Das "Format" einer Zelle besteht aus vielen Einzelteilen, die manchmal gar nicht abweichend vom "Default" gesetzt sind.
Die vielen Einzelheiten sind zu kopieren.

Möglichkeit A:
versuche, ob Du mit der Makro-Aufzeichnung (Bearbeiten>Inhalte einfügen>Formate) einen brauchbaren Code hin bekommst.

Möglichkeit B:
Arbeite von vorne herein mit styles, dann ist es einfach

Code: Alles auswählen

oRange.CellStyle = "MeinStil"
Möglichkeit C:
Erzeuge einen neuen Zell-Stil und setze die Eigenschaften, die Du kopieren willst. Dann Möglichkeit B anwenden.
MRI hilft Dir weiter (Eigenschaften der aktuellen Zelle erfassen):

Code: Alles auswählen

  
  Dim oCurrentSelection As Variant
  Dim aBottomBorder As New com.sun.star.table.BorderLine
  Dim nCellBackColor As Long
  Dim nCharColor As Long
  Dim bCharContoured As Boolean
  Dim bCharCrossedOut As Boolean
  Dim nCharEmphasis As Integer
  Dim nCharFont As Integer
  Dim nCharFontCharSet As Integer
  Dim nCharFontCharSetAsian As Integer
  Dim nCharFontCharSetComplex As Integer
  Dim nCharFontFamily As Integer
  Dim nCharFontFamilyAsian As Integer
  Dim nCharFontFamilyComplex As Integer
  Dim sCharFontName As String
  Dim sCharFontNameAsian As String
  Dim sCharFontNameComplex As String
  Dim nCharFontPitch As Integer
  Dim nCharFontPitchAsian As Integer
  Dim nCharFontPitchComplex As Integer
  Dim sCharFontStyleName As String
  Dim sCharFontStyleNameAsian As String
  Dim sCharFontStyleNameComplex As String
  Dim nCharHeight As Single
  Dim nCharHeightAsian As Single
  Dim nCharHeightComplex As Single
  Dim aCharLocale As New com.sun.star.lang.Locale
  Dim aCharLocaleAsian As New com.sun.star.lang.Locale
  Dim aCharLocaleComplex As New com.sun.star.lang.Locale
  Dim nCharOverline As Integer
  Dim nCharOverlineColor As Long
  Dim bCharOverlineHasColor As Boolean
  Dim nCharPosture As Long
  Dim nCharPostureAsian As Long
  Dim nCharPostureComplex As Long
  Dim nCharRelief As Integer
  Dim bCharShadowed As Boolean
  Dim nCharStrikeout As Integer
  Dim nCharUnderline As Integer
  Dim nCharUnderlineColor As Long
  Dim bCharUnderlineHasColor As Boolean
  Dim nCharWeight As Single
  Dim nCharWeightAsian As Single
  Dim nCharWeightComplex As Single
  Dim bCharWordMode As Boolean
  Dim oConditionalFormat As Variant
  Dim oConditionalFormatLocal As Variant
  Dim oConditionalFormatXML As Variant
  Dim nHoriJustify As Long
  Dim bIsCellBackgroundTransparent As Boolean
  Dim aLeftBorder As New com.sun.star.table.BorderLine
  Dim nNumberFormat As Long
  Dim oNumberingRules As Variant
  Dim nOrientation As Long
  Dim nParaAdjust As Integer
  Dim nParaBottomMargin As Long
  Dim nParaIndent As Integer
  Dim bParaIsCharacterDistance As Boolean
  Dim bParaIsForbiddenRules As Boolean
  Dim bParaIsHangingPunctuation As Boolean
  Dim bParaIsHyphenation As Boolean
  Dim nParaLastLineAdjust As Integer
  Dim nParaLeftMargin As Long
  Dim nParaRightMargin As Long
  Dim nParaTopMargin As Long
  Dim aPosition As New com.sun.star.awt.Point
  Dim aRightBorder As New com.sun.star.table.BorderLine
  Dim bShrinkToFit As Boolean
  Dim aShadowFormat As New com.sun.star.table.ShadowFormat
  Dim nVertJustify As Long

  oCurrentSelection = ThisComponent.getCurrentSelection()
  aBottomBorder = oCurrentSelection.BottomBorder
  nCellBackColor = oCurrentSelection.CellBackColor
  
  nCharColor = oCurrentSelection.CharColor
  bCharContoured = oCurrentSelection.CharContoured
  bCharCrossedOut = oCurrentSelection.CharCrossedOut
  
  nCharEmphasis = oCurrentSelection.CharEmphasis
  nCharFont = oCurrentSelection.CharFont
  nCharFontCharSet = oCurrentSelection.CharFontCharSet
  
  nCharFontCharSetAsian = oCurrentSelection.CharFontCharSetAsian
  nCharFontCharSetComplex = oCurrentSelection.CharFontCharSetComplex
  nCharFontFamily = oCurrentSelection.CharFontFamily
  
  nCharFontFamilyAsian = oCurrentSelection.CharFontFamilyAsian
  nCharFontFamilyComplex = oCurrentSelection.CharFontFamilyComplex
  sCharFontName = oCurrentSelection.CharFontName
  
  sCharFontNameAsian = oCurrentSelection.CharFontNameAsian
  sCharFontNameComplex = oCurrentSelection.CharFontNameComplex
  nCharFontPitch = oCurrentSelection.CharFontPitch
  
  nCharFontPitchAsian = oCurrentSelection.CharFontPitchAsian
  nCharFontPitchComplex = oCurrentSelection.CharFontPitchComplex
  sCharFontStyleName = oCurrentSelection.CharFontStyleName
  
  sCharFontStyleNameAsian = oCurrentSelection.CharFontStyleNameAsian
  sCharFontStyleNameComplex = oCurrentSelection.CharFontStyleNameComplex
  nCharHeight = oCurrentSelection.CharHeight
  
  nCharHeightAsian = oCurrentSelection.CharHeightAsian
  nCharHeightComplex = oCurrentSelection.CharHeightComplex
  aCharLocale = oCurrentSelection.CharLocale
  
  aCharLocaleAsian = oCurrentSelection.CharLocaleAsian
  aCharLocaleComplex = oCurrentSelection.CharLocaleComplex
  nCharOverline = oCurrentSelection.CharOverline
  
  nCharOverlineColor = oCurrentSelection.CharOverlineColor
  bCharOverlineHasColor = oCurrentSelection.CharOverlineHasColor
  nCharPosture = oCurrentSelection.CharPosture
  
  nCharPostureAsian = oCurrentSelection.CharPostureAsian
  nCharPostureComplex = oCurrentSelection.CharPostureComplex
  nCharRelief = oCurrentSelection.CharRelief
  
  bCharShadowed = oCurrentSelection.CharShadowed
  nCharStrikeout = oCurrentSelection.CharStrikeout
  nCharUnderline = oCurrentSelection.CharUnderline
  
  nCharUnderlineColor = oCurrentSelection.CharUnderlineColor
  bCharUnderlineHasColor = oCurrentSelection.CharUnderlineHasColor
  nCharWeight = oCurrentSelection.CharWeight
  
  nCharWeightAsian = oCurrentSelection.CharWeightAsian
  nCharWeightComplex = oCurrentSelection.CharWeightComplex
  bCharWordMode = oCurrentSelection.CharWordMode
  
  oConditionalFormat = oCurrentSelection.ConditionalFormat
  oConditionalFormatLocal = oCurrentSelection.ConditionalFormatLocal
  oConditionalFormatXML = oCurrentSelection.ConditionalFormatXML
  
  nHoriJustify = oCurrentSelection.HoriJustify
  bIsCellBackgroundTransparent = oCurrentSelection.IsCellBackgroundTransparent
  aLeftBorder = oCurrentSelection.LeftBorder
  
  nNumberFormat = oCurrentSelection.NumberFormat
  oNumberingRules = oCurrentSelection.NumberingRules
  nOrientation = oCurrentSelection.Orientation
  
  nParaAdjust = oCurrentSelection.ParaAdjust
  nParaBottomMargin = oCurrentSelection.ParaBottomMargin
  nParaIndent = oCurrentSelection.ParaIndent
  
  bParaIsCharacterDistance = oCurrentSelection.ParaIsCharacterDistance
  bParaIsForbiddenRules = oCurrentSelection.ParaIsForbiddenRules
  bParaIsHangingPunctuation = oCurrentSelection.ParaIsHangingPunctuation
  
  bParaIsHyphenation = oCurrentSelection.ParaIsHyphenation
  nParaLastLineAdjust = oCurrentSelection.ParaLastLineAdjust
  nParaLeftMargin = oCurrentSelection.ParaLeftMargin
  
  nParaRightMargin = oCurrentSelection.ParaRightMargin
  nParaTopMargin = oCurrentSelection.ParaTopMargin
  aPosition = oCurrentSelection.Position
  
  aRightBorder = oCurrentSelection.RightBorder
  bShrinkToFit = oCurrentSelection.ShrinkToFit
  aShadowFormat = oCurrentSelection.ShadowFormat
  
  nVertJustify = oCurrentSelection.VertJustify
:o

Gibt leider keine oCell.CopyStyle Anweisung
Cheers
Winfried
aktuell: openSuse 13.1 mit LO 4.3.7.2
DateTime2 Einfügen von Datum/Zeit/Zeitstempel (als Extension)


An alle, die das LibreOffice-Forum gern nutzen und unterstützen wollen:


Bitte helfen Sie uns mit 7 Euro pro Monat.
Durch Ihren Beitrag tragen Sie dazu bei, unsere laufenden Kosten für die kommenden Monate zu decken.
Unkompliziert per Kreditkarte oder PayPal.
Als ein kleines Dankeschön werden Sie im LO-Forum als SUPPORTER gekennzeichnet.



Antworten