incubator-ooo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ariel Constenla-Haile <arie...@apache.org>
Subject Re: Is there difference of Author Field create by UNO API and UI Insert->Fields->Author
Date Thu, 23 Aug 2012 15:41:33 GMT

Hi Oliver,

On Thu, Aug 23, 2012 at 10:49:17AM +0200, Oliver Brinzing wrote:
> 
> seems, there are 2 different fields:
> 
> API: <text:author-name text:fixed="false">MyName</text:author-name>

this is
file:///opt/openoffice.org/basis3.4/sdk/docs/common/ref/com/sun/star/text/textfield/Author.html


> GUI: <text:initial-creator>MyName</text:initial-creator>

this is
file:///opt/openoffice.org/basis3.4/sdk/docs/common/ref/com/sun/star/text/textfield/docinfo/CreateAuthor.html


The following code:


Sub Main
    On Error Resume Next
    Dim oDoc as Object
    oDoc = StarDesktop.loadComponentFromURL(_
        "private:factory/swriter", "_default", 0, Array())

    Dim oText as Object
    oText = oDoc.getText()
    
    Dim oCursor as Object
    oCursor = oText.createTextCursorByRange(oText.getStart())

    Dim oAuthorField as Object
    oAuthorField = oDoc.createInstance("com.sun.star.text.textfield.Author")
    oAuthorField.setPropertyValue("FullName", TRUE)
    oText.insertTextContent( oCursor.getEnd(), oAuthorField, false)
    oText.insertControlCharacter( oCursor.getEnd(),_
            com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false )

    oAuthorField = oDoc.createInstance("com.sun.star.text.textfield.Author")
    oAuthorField.setPropertyValue("FullName", FALSE)
    oText.insertTextContent( oCursor.getEnd(), oAuthorField, false)
    oText.insertControlCharacter( oCursor.getEnd(),_
            com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false )

    Dim oInitialCreatorField as Object
    oInitialCreatorField = oDoc.createInstance("com.sun.star.text.textfield.docinfo.CreateAuthor")
    oText.insertTextContent( oCursor.getEnd(), oInitialCreatorField, false)
End Sub


Produces 3 different fields:

<text:p text:style-name="Standard">
    <text:author-name text:fixed="false">Ariel Constenla-Haile</text:author-name>
</text:p>
<text:p text:style-name="Standard">
    <text:author-initials text:fixed="false">AC</text:author-initials>
</text:p>
<text:p text:style-name="Standard">
    <text:initial-creator>Ariel Constenla-Haile</text:initial-creator>
</text:p>


Note that optional property AuthorFormat does not exist.

http://www.openoffice.org/api/docs/common/ref/com/sun/star/text/textfield/Author.html#AuthorFormat


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Mime
View raw message