OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Macro to make the header read-only

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
reut
General User
General User


Joined: 07 Feb 2003
Posts: 27
Location: Moravia

PostPosted: Tue Jun 22, 2004 10:51 pm    Post subject: Macro to make the header read-only Reply with quote

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
View user's profile Send private message Send e-mail
verflixtnix
Power User
Power User


Joined: 11 May 2004
Posts: 79
Location: Germany, Hamburg

PostPosted: Thu Jun 24, 2004 11:28 am    Post subject: Reply with quote

Hi,

in the past, I used a protected textframe...no everthing will change Smile
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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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