| View previous topic :: View next topic |
| Author |
Message |
reut General User


Joined: 07 Feb 2003 Posts: 27 Location: Moravia
|
Posted: Tue Jun 22, 2004 10:51 pm Post subject: Macro to make the header read-only |
|
|
Hi all!
I know how to create header via macro, but now I need to figure out how to make this header read-only. Does anybody have an idea where I can find some examples in StarBasic to this subject?
Thanks.
OOo 1.1.1., Win2000, StarBasic |
|
| Back to top |
|
 |
verflixtnix Power User

Joined: 11 May 2004 Posts: 79 Location: Germany, Hamburg
|
Posted: Thu Jun 24, 2004 11:28 am Post subject: |
|
|
Hi,
in the past, I used a protected textframe...no everthing will change
What do you think about a textsection in the header?
| Code: | Sub readOnlyHeader
oDoc = StarDesktop.CurrentComponent
oDocController = oDoc.CurrentController
oDocText = oDoc.Text
oDocCursor = oDocText.createTextCursor()
'Set Page Style
oStyleFamilies= oDoc.getStyleFamilies()
oPageStyles = oStyleFamilies.getByName("PageStyles")
oPageStyle = oPageStyles.getByName("Standard")
vTopMargin = 900
vLeftMargin = 1900
vRightMargin = 1000
vHeadHoriOrientPosition = 15500
vHeaderHeight = 4000
vBottomMargin = 500
vFooterHeight = 500
with oPageStyle
'Pageframe
.LeftMargin = vLeftMargin
.RightMargin = vRightMargin
.TopMargin = vTopMargin
.BottomMargin = vBottomMargin
'Header
.HeaderIsOn = True
.HeaderHeight = vHeaderHeight
.HeaderIsDynamicHeight = False
'Footer
.FooterIsOn = True
.FooterHeight = vFooterHeight
end with
oHeader = oPageStyle.HeaderText
oHeaderText = oHeader.Text
oHeaderCursor = oHeaderText.createTextCursor()
oHeaderText.insertControlCharacter(oHeaderCursor, ControlCharacter_PARAGRAPH_BREAK, FALSE)
oHeaderText.insertControlCharacter(oHeaderCursor, ControlCharacter_PARAGRAPH_BREAK, FALSE)
oHeaderText.insertControlCharacter(oHeaderCursor, ControlCharacter_PARAGRAPH_BREAK, FALSE)
oHeaderText.insertControlCharacter(oHeaderCursor, ControlCharacter_PARAGRAPH_BREAK, FALSE)
oHeaderText.insertControlCharacter(oHeaderCursor, ControlCharacter_PARAGRAPH_BREAK, FALSE)
oHeaderText.insertControlCharacter(oHeaderCursor, ControlCharacter_PARAGRAPH_BREAK, FALSE)
oTextSection = oDoc.createInstance("com.sun.star.text.TextSection")
oTextSection.setName("MyTextSection")
'oTextSection.IsProtected(True) *** I tried this at first, but the section wasn't protected
oHeaderCursor.gotoStart(False)
oHeaderCursor.gotoEnd(true)
oHeaderText.insertTextContent(oHeaderCursor, oTextSection, true)
oSections = oDoc.getTextSections()
oSections.getByName("MyTextSection").IsProtected = TRUE
End Sub |
An interesting message for me was:
http://www.oooforum.org/forum/viewtopic.php?t=8615 _________________ Jan Lüdtke
SuseLinux9.0 - OOo1.1.2 / Win2000 - OOo1.1.2 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|