You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by fabian <fm...@netempire.de> on 2012/05/21 15:33:45 UTC

Size of page headder

Hi,

I want to find out the height of a document's header. Reading out the attribute HeaderHeight of the page properties only returns 0 and getting the XText of the header also didn't get me nowhere so far.

My goal is to insert a graphic at a user specified position of the page and for different reasons I can't simply use page as anchor. Therefore I need to know the height and width of the page margins and the page header to position the image independently of those dimensions.

Has anybody a hint how to get the header's height. 

best Fabian.



Re: Size of page headder

Posted by Fernand Vanrie <so...@pmgroup.be>.
  fabian ,

the missing millimeters comes from the "style"  and the "fond". I 
suppose the coordinates off the vieuwcursor are calculated from the 
"baseline" , Styles can have TOP, BOTTOM , LEFT and RIGHT margins.......
>> Right,
>>
>> the attribute dynamicHeight is true. In which case is a header not dynamic? I tried to create a template with a ott, but when I load this ott the header is still dynamic.  I like the idea using the viewCursor but I only know how to create it by a textViewsupplier and not from my text cursor.
>>
>> thanks!
>>
>> best,
>> Fabian
> I was able to get the Point coordinates of the End of my header textRange with the XtextViewCursor… This brings me close now to the right position. But still some millimeters are missing in my calculation, I guess some distance between the end of the textRange and the end of the header.
> Its definitely not the distance between header and body since I get this distance from the page styles.
>
>
>
>


Re: Size of page headder

Posted by fabian <fm...@netempire.de>.
> Right,
> 
> the attribute dynamicHeight is true. In which case is a header not dynamic? I tried to create a template with a ott, but when I load this ott the header is still dynamic.  I like the idea using the viewCursor but I only know how to create it by a textViewsupplier and not from my text cursor.
> 
> thanks!
> 
> best,
> Fabian

I was able to get the Point coordinates of the End of my header textRange with the XtextViewCursor… This brings me close now to the right position. But still some millimeters are missing in my calculation, I guess some distance between the end of the textRange and the end of the header. 
Its definitely not the distance between header and body since I get this distance from the page styles.




Re: Size of page headder

Posted by fabian <fm...@netempire.de>.
Right,

the attribute dynamicHeight is true. In which case is a header not dynamic? I tried to create a template with a ott, but when I load this ott the header is still dynamic.  I like the idea using the viewCursor but I only know how to create it by a textViewsupplier and not from my text cursor. 

thanks!

best,
Fabian

On May 22, 2012, at 6:19 PM, Fernand Vanrie wrote:

> fabian,
> 
> Your headers have a "dynamic" height ?
> 
> Maybe you can move the viewcursor init and calculate the height from its position on start en end of the header ?
>> Hi Fernand,
>> 
>> I programing in Java but I already did what you described below. The pagestyles contain the the property "HeaderHeight" but as I wrote this always returns 0 independently of how many lines I wrote in the header.
>> There is also the attribute "HeaderText" which gives me a XText of the Header content but this won't help since it's only the text.
>> 
>> I haven't tried to iterate over the frames yet, this might work for me…
>> 
>> best,
>> Fabian
>> 
>> 
>> On May 21, 2012, at 4:08 PM, Fernand Vanrie wrote:
>> 
>>> fabian ,
>>> 
>>> You can find it in the "page styles"
>>> 
>>> Find my code belmow to handle some "text" i placed in a textframe (named "MyFooterFrame" )in the footer, you can do the same with the Header. Do a xray on the pagestyles to have additional information about the Header.
>>> 
>>> Hop it helps
>>> 
>>> Fernand
>>> 
>>> Sub FooterText
>>> ' On Local Error GoTo GeenFooterFrame
>>> If (Not GlobalScope.BasicLibraries.isLibraryLoaded("Tools")) Then
>>>           GlobalScope.BasicLibraries.LoadLibrary("Tools")
>>> End If
>>> oDocument = thisComponent
>>> oStyles = oDocument.getStyleFamilies.getByName("PageStyles")
>>> oFrames = oDocument.getTextFrames
>>> xray ostyles.getbyindex(0)
>>> oFooterframe = Oframes.getByName("MyFooterFrame")
>>> 
>>> oFooterText = oFooterFrame.Text
>>> oFootertext.setstring("")
>>> oFooterCursor = oFooterText.createTextCursor()
>>> oFooterText.insertString(oFooterCursor, FileNameoutofPath(oDocument.Url , "/") , true)
>>> exit sub
>>> 
>>> GeenFooterFrame:
>>> beep
>>> msgbox( "Er is geen ""FooterFrame"" meer, copieer het frame uit een ander document en ga verder" ,48)
>>> exit sub
>>> 
>>> End Sub
>>> 
>>>> Hi,
>>>> 
>>>> I want to find out the height of a document's header. Reading out the attribute HeaderHeight of the page properties only returns 0 and getting the XText of the header also didn't get me nowhere so far.
>>>> 
>>>> My goal is to insert a graphic at a user specified position of the page and for different reasons I can't simply use page as anchor. Therefore I need to know the height and width of the page margins and the page header to position the image independently of those dimensions.
>>>> 
>>>> Has anybody a hint how to get the header's height.
>>>> 
>>>> best Fabian.
>>>> 
>>>> 
>>>> 
>> 
> 


Re: Size of page headder

Posted by Fernand Vanrie <so...@pmgroup.be>.
fabian,

Your headers have a "dynamic" height ?

Maybe you can move the viewcursor init and calculate the height from its 
position on start en end of the header ?
> Hi Fernand,
>
> I programing in Java but I already did what you described below. The pagestyles contain the the property "HeaderHeight" but as I wrote this always returns 0 independently of how many lines I wrote in the header.
> There is also the attribute "HeaderText" which gives me a XText of the Header content but this won't help since it's only the text.
>
> I haven't tried to iterate over the frames yet, this might work for me…
>
> best,
> Fabian
>
>
> On May 21, 2012, at 4:08 PM, Fernand Vanrie wrote:
>
>> fabian ,
>>
>> You can find it in the "page styles"
>>
>> Find my code belmow to handle some "text" i placed in a textframe (named "MyFooterFrame" )in the footer, you can do the same with the Header. Do a xray on the pagestyles to have additional information about the Header.
>>
>> Hop it helps
>>
>> Fernand
>>
>> Sub FooterText
>> ' On Local Error GoTo GeenFooterFrame
>> If (Not GlobalScope.BasicLibraries.isLibraryLoaded("Tools")) Then
>>            GlobalScope.BasicLibraries.LoadLibrary("Tools")
>> End If
>> oDocument = thisComponent
>> oStyles = oDocument.getStyleFamilies.getByName("PageStyles")
>> oFrames = oDocument.getTextFrames
>> xray ostyles.getbyindex(0)
>> oFooterframe = Oframes.getByName("MyFooterFrame")
>>
>> oFooterText = oFooterFrame.Text
>> oFootertext.setstring("")
>> oFooterCursor = oFooterText.createTextCursor()
>> oFooterText.insertString(oFooterCursor, FileNameoutofPath(oDocument.Url , "/") , true)
>> exit sub
>>
>> GeenFooterFrame:
>> beep
>> msgbox( "Er is geen ""FooterFrame"" meer, copieer het frame uit een ander document en ga verder" ,48)
>> exit sub
>>
>> End Sub
>>
>>> Hi,
>>>
>>> I want to find out the height of a document's header. Reading out the attribute HeaderHeight of the page properties only returns 0 and getting the XText of the header also didn't get me nowhere so far.
>>>
>>> My goal is to insert a graphic at a user specified position of the page and for different reasons I can't simply use page as anchor. Therefore I need to know the height and width of the page margins and the page header to position the image independently of those dimensions.
>>>
>>> Has anybody a hint how to get the header's height.
>>>
>>> best Fabian.
>>>
>>>
>>>
>


Re: Size of page headder

Posted by fabian <fm...@netempire.de>.
Hi Fernand,

I programing in Java but I already did what you described below. The pagestyles contain the the property "HeaderHeight" but as I wrote this always returns 0 independently of how many lines I wrote in the header.
There is also the attribute "HeaderText" which gives me a XText of the Header content but this won't help since it's only the text.

I haven't tried to iterate over the frames yet, this might work for me…

best,
Fabian


On May 21, 2012, at 4:08 PM, Fernand Vanrie wrote:

> fabian ,
> 
> You can find it in the "page styles"
> 
> Find my code belmow to handle some "text" i placed in a textframe (named "MyFooterFrame" )in the footer, you can do the same with the Header. Do a xray on the pagestyles to have additional information about the Header.
> 
> Hop it helps
> 
> Fernand
> 
> Sub FooterText
> ' On Local Error GoTo GeenFooterFrame
> If (Not GlobalScope.BasicLibraries.isLibraryLoaded("Tools")) Then
>           GlobalScope.BasicLibraries.LoadLibrary("Tools")
> End If
> oDocument = thisComponent
> oStyles = oDocument.getStyleFamilies.getByName("PageStyles")
> oFrames = oDocument.getTextFrames
> xray ostyles.getbyindex(0)
> oFooterframe = Oframes.getByName("MyFooterFrame")
> 
> oFooterText = oFooterFrame.Text
> oFootertext.setstring("")
> oFooterCursor = oFooterText.createTextCursor()
> oFooterText.insertString(oFooterCursor, FileNameoutofPath(oDocument.Url , "/") , true)
> exit sub
> 
> GeenFooterFrame:
> beep
> msgbox( "Er is geen ""FooterFrame"" meer, copieer het frame uit een ander document en ga verder" ,48)
> exit sub
> 
> End Sub
> 
>> Hi,
>> 
>> I want to find out the height of a document's header. Reading out the attribute HeaderHeight of the page properties only returns 0 and getting the XText of the header also didn't get me nowhere so far.
>> 
>> My goal is to insert a graphic at a user specified position of the page and for different reasons I can't simply use page as anchor. Therefore I need to know the height and width of the page margins and the page header to position the image independently of those dimensions.
>> 
>> Has anybody a hint how to get the header's height.
>> 
>> best Fabian.
>> 
>> 
>> 
> 


Re: Size of page headder

Posted by Fernand Vanrie <so...@pmgroup.be>.
  fabian ,

You can find it in the "page styles"

Find my code belmow to handle some "text" i placed in a textframe (named 
"MyFooterFrame" )in the footer, you can do the same with the Header. Do 
a xray on the pagestyles to have additional information about the Header.

Hop it helps

Fernand

Sub FooterText
' On Local Error GoTo GeenFooterFrame
  If (Not GlobalScope.BasicLibraries.isLibraryLoaded("Tools")) Then
            GlobalScope.BasicLibraries.LoadLibrary("Tools")
  End If
oDocument = thisComponent
oStyles = oDocument.getStyleFamilies.getByName("PageStyles")
oFrames = oDocument.getTextFrames
xray ostyles.getbyindex(0)
oFooterframe = Oframes.getByName("MyFooterFrame")

oFooterText = oFooterFrame.Text
oFootertext.setstring("")
oFooterCursor = oFooterText.createTextCursor()
oFooterText.insertString(oFooterCursor, FileNameoutofPath(oDocument.Url 
, "/") , true)
exit sub

GeenFooterFrame:
beep
msgbox( "Er is geen ""FooterFrame"" meer, copieer het frame uit een 
ander document en ga verder" ,48)
exit sub

End Sub

> Hi,
>
> I want to find out the height of a document's header. Reading out the attribute HeaderHeight of the page properties only returns 0 and getting the XText of the header also didn't get me nowhere so far.
>
> My goal is to insert a graphic at a user specified position of the page and for different reasons I can't simply use page as anchor. Therefore I need to know the height and width of the page margins and the page header to position the image independently of those dimensions.
>
> Has anybody a hint how to get the header's height.
>
> best Fabian.
>
>
>