I min Version 3.6.2.2 (Build ID: da8c1e6) får jeg alene en Pladsholder 00-00-0000, når jeg klikker på Dato i Sidefod eller Sidehoved. Det er først, når jeg åbner Vis udskrift, eller udskriver dokumentet, at datoen viser sig. Datoen og tidsangivelsen er ikke fast, dvs. data ændres med tiden.
Kan jeg redigere i opsætningen, så dato/tid holdes fast?
Kan jeg ændre datoformatet?
Datering i Sidehoved sidefod
Moderator: Lodahl
-
- Posts: 144
- Joined: 27. Oct 2003 22:00
- Location: Jyllinge
Datering i Sidehoved sidefod
Med venlig hilsen
Louis
Louis
Hej
Du kan muligvis ændre datoen med en makro, men det vil være lettere at droppe sidehoved og indsætte en dato i den øverste række i regnearket. Eller du kan ændre ark-navn til f.eks. 01-11-12 og så bruge den i sidehoved
mvh
Jens
NB! her er makroen der indsætter datotid i højre ramme i sidehoved:
Du kan muligvis ændre datoen med en makro, men det vil være lettere at droppe sidehoved og indsætte en dato i den øverste række i regnearket. Eller du kan ændre ark-navn til f.eks. 01-11-12 og så bruge den i sidehoved
mvh
Jens
NB! her er makroen der indsætter datotid i højre ramme i sidehoved:
Code: Select all
REM ***** BASIC *****
OPTION EXPLICIT
Function EditFHText(H_F, L_C_R as integer, MyContent as string) as string
Dim oDocument as Object
Dim oView as Object
Dim oSheet as object
Dim oPStyle as Object
Dim oThisStyle as Object
Dim oFHContent as Object
Dim oText as Object
Dim oCursor as Object
Dim oField as Object
Dim i as integer
Dim StyleName as string
Dim sAns as String
rem Adjusting the actual pagestyle (Pagestyle of actual WorkSheet in this document)
oDocument = ThisComponent
oView = ThisComponent.getCurrentController()
oSheet = oView.getActiveSheet()
'oSheet = oDocument.Sheets.getByIndex( WS_Index-1 )
oPStyle = oDocument.StyleFamilies.getByName("PageStyles")
oThisStyle = oPStyle.getByName(oSheet.PageStyle)
StyleName = oThisStyle.Name
select case H_F 'Header=1, Footer=0
case 0
oThisStyle.FooterOn = True
oFHContent = oThisStyle.RightPageFooterContent ' Get the all existing text from running foot
case 1
oThisStyle.HeaderOn = True ' True/False turns on/off the runninghead
oFHContent = oThisStyle.RightPageHeaderContent ' Get the all existing text from running foot
end select
select case L_C_R 'Left/Center/Right -1/0/1
case -1 'left = -1
' get and delete ...
oText = oFHContent.LeftText
oCursor = oText.createTextCursor()
oText.insertString(oCursor, "", True)
' formatting ...
oCursor.CharHeight = 12
oCursor.CharFontName = "Arial"
oCursor.CharWeight = com.sun.star.awt.FontWeight.NORMAL
oCursor.CharPosture = com.sun.star.awt.FontSlant.NONE
oCursor.CharUnderline = com.sun.star.awt.FontUnderline.NONE
' insert text ...
oText.insertString(oCursor, Content, False)
case 0 ' center = 0
' get and delete ...
oText = oFHContent.CenterText
oCursor = oText.createTextCursor()
oText.insertString(oCursor, "", True)
' formatting ...
oCursor.CharHeight = 12
oCursor.CharFontName = "Courir New"
oCursor.CharWeight = com.sun.star.awt.FontWeight.NORMAL
oCursor.CharPosture = com.sun.star.awt.FontSlant.NONE
oCursor.CharUnderline = com.sun.star.awt.FontUnderline.NONE
' insert text ...
oText.insertString(oCursor, MyContent, False)
case 1 'right = 1
oText = oFHContent.RightText
oCursor = oText.createTextCursor()
oText.insertString(oCursor, "", True)
oCursor.CharHeight = 12
oCursor.CharFontName = "Courir New"
oCursor.CharWeight = com.sun.star.awt.FontWeight.NORMAL
oCursor.CharPosture = com.sun.star.awt.FontSlant.NONE
oCursor.CharUnderline = com.sun.star.awt.FontUnderline.NONE
oText.insertString(oCursor, MyContent, False)
end select
'********************************************************
'write content back into running foot/head
select case H_F 'Header=1, Footer=0
case 0
oThisStyle.RightPageFooterContent = oFHContent
case 1
oThisStyle.RightPageHeaderContent = oFHContent
end select
EditFHText = StyleName & ": Style modified!"
End function
Sub LastModToFootRight
Dim ModifiedStr as Date
Dim svc as Object
svc = createUnoService( "com.sun.star.sheet.FunctionAccess" ) 'Create a service to use Calc functions
ModifiedStr = svc.callFunction("NOW", Array())
EditFHText(1,1,"Ændret: " & ModifiedStr) 'parameter 1,1 =sidehoved, højre felt
end Sub