Seite 1 von 1
Format einer Zelle (Calc) kopieren
Verfasst: Di 21. Apr 2015, 11:41
von weinbach
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
Re: Format einer Zelle (Calc) kopieren
Verfasst: So 31. Mai 2015, 21:30
von komma4
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
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
Gibt leider keine
oCell.CopyStyle Anweisung