[Libreoffice] Example of merging documents and retaining header/footer?

Grover Blue grover.blue at gmail.com
Mon Jun 13 09:53:11 PDT 2011


A few months ago I wrote a forum post at OpenOffice.org because I was having
problem transferring the header/footer contents and format between two
documents.

http://user.services.openoffice.org/en/forum/viewtopic.php?f=25&t=38739&p=180951

Basically, I'm using insertDocumentFromURL to merge two documents.
Unfortunately, that method doesn't import the header/footer to the pages of
the inserted document.  So, I attempt to manually add those, but to no
avail.

Here is what I'm doing (the forum post might be easier to read):

I mostly got it working, except for the copying of the actually
header/footer text. Whenever I read in a new document, the header and footer
text is always applied to the first page (or Default page style), instead of
the newly created page style. So, for instance, let's say I have the
following documents.

Document 1: Footer = "hello #1"
Document 2: Footer = "hello #2"
Document 3: Footer = "hello #3"
Document 4: Footer = "hello #4"

I first load Document 1, creating a new instance of DocumentWrapper (please
note that some code was left out for brevity).
Next, I append Document 2 by calling wrapper.appendDocument("path to
document 2"). This inserts document 2 with a page break and section break. A
new Page Style is create with the random name generated, but when I copy the
header/footer info from Document 2 into the new Page Style, it gets applied
to the Default Page Style, or page one.

Next, I append Document 3 by calling wrapper.appendDocument("path to
document 3"). This inserts document 3 after document 2 (with proper page
breaks), but again the header/footer data is applied to page 1, or Default
Page Style.

The same occurs for Document 4.

I've included all the relevant code below. Please note that I had to leave
the PAGE BREAK code as is, otherwise the insertion of a new document would
not occur on a new page. I may be able to leave out the Section Break, but I
for now it shouldn't be a problem. I think I initially used them because
some documents had multiple columns, but that is handled with the page
styles.

Any additional thoughts?

public class DocumentWrapper {

    private XTextDocument document;

    public void appendDocument(String tempDoc) throws
IllegalArgumentException, java.lang.Exception {

            PropertyValue[] xComponentLoadProps = ... //"AsTemplate",
"Hidden"

            DocumentWrapper document22 = new
DocumentWrapper(componentImport(tempDoc, xComponentLoadProps));

            String newStyleName = String.valueOf("ps_" + Math.random());

            XStyle document2Style =
document2.getStyle(StyleFamilies.PageStyles, PageStyles.Standard);

            document.getText().createTextCursor().gotoEnd(false);


            XTextCursor cursor = this.insertSectionBreak(newStyleName);

            XDocumentInsertable xDocI = (XDocumentInsertable)
getOOoUnoRuntimeQueryInterface(XDocumentInsertable.class, cursor);

            xDocI.insertDocumentFromURL((new
File(tempDoc)).toURI().toString(), new PropertyValue[0]);

            Object o =
getOOoUnoRuntimeServiceCreateInstance("com.sun.star.style.PageStyle",
document);

            XStyle newPageStyle = (XStyle)
getOOoUnoRuntimeQueryInterface(XStyle.class, o);

            newPageStyle.setName(newStyleName);

            DocumentWrapper.copyPageStyleProperties(document2Style,
newPageStyle);

            this.setStyle(StyleFamilies.PageStyles, newPageStyle);

            XParagraphCursor xParaCursor = (XParagraphCursor)
getOOoUnoRuntimeQueryInterface( XParagraphCursor.class, cursor);

            XPropertySet paraProps = (XPropertySet)
getOOoUnoRuntimeQueryInterface( XPropertySet.class, xParaCursor);


paraProps.setPropertyValue(ParagraphStyleProperties.PageDescName,
newPageStyleName);

       paraProps = null;

            xParaCursor = null;

            xDocI = null;

            cursor = null;

            document2Style = null;

            newStyleName = null;

    }

    public XTextCursor insertSectionBreak(String newSectionName) throws
UnknownPropertyException, IllegalArgumentException, WrappedTargetException,
PropertyVetoException, Exception, java.lang.Exception {

        XText xDocText = this.document.getText();

        XTextCursor xOrigDocTextCursor = xDocText.createTextCursor();

        xOrigDocTextCursor.gotoEnd(false);

        XPropertySet xOrigDocTextCursorProp = (XPropertySet)
getOOoUnoRuntimeQueryInterface(XPropertySet.class, xOrigDocTextCursor);

        xOrigDocTextCursorProp.setPropertyValue("BreakType",
BreakType.PAGE_BEFORE);

        xDocText.insertControlCharacter(xOrigDocTextCursor,
ControlCharacter.PARAGRAPH_BREAK, false);
        xOrigDocTextCursorProp.setPropertyValue("BreakType",
BreakType.NONE);

        XParagraphCursor xParaCursor = (XParagraphCursor)
getOOoUnoRuntimeQueryInterface( XParagraphCursor.class, xOrigDocTextCursor);

        xParaCursor.gotoPreviousParagraph(false);

        XNamed xChildNamed = (XNamed) getOOoUnoRuntimeQueryInterface(

                XNamed.class,


getOOoUnoRuntimeServiceCreateInstance("com.sun.star.text.TextSection",
this.document));

        xChildNamed.setName(newSectionName);

        XTextContent xChildContent = (XTextContent)
getOOoUnoRuntimeQueryInterface(XTextContent.class, xChildNamed);

        xDocText.insertTextContent(xOrigDocTextCursor, xChildContent,
false);

        xParaCursor.gotoPreviousParagraph(false);

        xOrigDocTextCursorProp = null;

        xParaCursor = null;

        xDocText = null;

        xChildNamed = null;

        xChildContent = null;

        return xOrigDocTextCursor;

    }

    public static void copyHeaderProperties(XPropertySet fromProps,
XPropertySet toProps) throws UnknownPropertyException,
WrappedTargetException, PropertyVetoException, IllegalArgumentException {


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderBackColor,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderBackColor));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderBackGraphicFilter,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderBackGraphicFilter));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderBackGraphicLocation,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderBackGraphicLocation));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderBackGraphicURL,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderBackGraphicURL));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderBackTransparent,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderBackTransparent));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderBodyDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderBodyDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderBorderDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderBottomBorder,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderBottomBorder));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderBottomBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderBottomBorderDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderDynamicSpacing,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderDynamicSpacing));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderHeight,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderHeight));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderIsDynamicHeight,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderIsDynamicHeight));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderLeftBorder,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderLeftBorder));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderLeftBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderLeftBorderDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderLeftMargin,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderLeftMargin));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderRightBorder,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderRightBorder));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderRightBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderRightBorderDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderRightMargin,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderRightMargin));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderShadowFormat,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderShadowFormat));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderTopBorder,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderTopBorder));


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderTopBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderTopBorderDistance));

        Boolean isOn = Boolean.FALSE;

        Boolean isShared = Boolean.FALSE;

        Object objectIsOn =
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderIsOn);

        Object objectIsShared =
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderIsShared);

        if (objectIsOn instanceof Any){

            if (((Any)objectIsOn).getType() == Type.BOOLEAN){

                isOn = (Boolean) ((Any)objectIsOn).getObject();

            }

        } else if (objectIsOn instanceof Boolean){

            isOn = (Boolean) objectIsOn;

        }

        if (objectIsShared instanceof Any){

            if (((Any)objectIsShared).getType() == Type.BOOLEAN){

                isShared = (Boolean) ((Any)objectIsShared).getObject();

            }

        } else if (objectIsShared instanceof Boolean){

            isShared = (Boolean) objectIsShared;

        }

        objectIsOn = null;

        objectIsShared = null;

        toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderIsOn,
isOn);


toProps.setPropertyValue(PageStyles.PageStyleProperties.HeaderIsShared,
isShared);

        XText fromXText = null;

        XText toXText = null;

        fromXText = (XText) getOOoUnoRuntimeQueryInterface(XText.class,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderText));

        if (isOn.booleanValue() && isShared.booleanValue() && fromXText !=
null && fromXText.getString() != null && !fromXText.getString().isEmpty()){

            toXText = (XText) getOOoUnoRuntimeQueryInterface(XText.class,
toProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderText));

            toXText.setString(fromXText.getString());

        }

        fromXText = (XText) getOOoUnoRuntimeQueryInterface(XText.class,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderTextLeft));

        if (isOn.booleanValue() && isShared.booleanValue() && fromXText !=
null && fromXText.getString() != null && !fromXText.getString().isEmpty()){

            toXText = (XText) getOOoUnoRuntimeQueryInterface(XText.class,
toProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderTextLeft));

            toXText.setString(fromXText.getString());

        }

        fromXText = (XText) getOOoUnoRuntimeQueryInterface(XText.class,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderTextRight));

        if (isOn.booleanValue() && isShared.booleanValue() && fromXText !=
null && fromXText.getString() != null && !fromXText.getString().isEmpty()){

            toXText = (XText) getOOoUnoRuntimeQueryInterface(XText.class,
toProps.getPropertyValue(PageStyles.PageStyleProperties.HeaderTextRight));

            toXText.setString(fromXText.getString());

        }

        fromXText = null;

        toXText = null;

    }

    public static void copyFooterProperties(XPropertySet fromProps,
XPropertySet toProps) throws UnknownPropertyException,
WrappedTargetException, PropertyVetoException, IllegalArgumentException {


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterBackColor,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterBackColor));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterBackGraphicFilter,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterBackGraphicFilter));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterBackGraphicLocation,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterBackGraphicLocation));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterBackGraphicURL,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterBackGraphicURL));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterBackTransparent,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterBackTransparent));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterBodyDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterBodyDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterBorderDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterBottomBorder,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterBottomBorder));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterBottomBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterBottomBorderDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterDynamicSpacing,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterDynamicSpacing));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterHeight,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterHeight));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterIsDynamicHeight,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterIsDynamicHeight));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterLeftBorder,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterLeftBorder));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterLeftBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterLeftBorderDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterLeftMargin,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterLeftMargin));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterRightBorder,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterRightBorder));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterRightBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterRightBorderDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterRightMargin,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterRightMargin));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterShadowFormat,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterShadowFormat));

        Boolean isOn = Boolean.FALSE;

        Boolean isShared = Boolean.FALSE;

        Object objectIsOn =
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterIsOn);

        Object objectIsShared =
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterIsShared);

        if (objectIsOn instanceof Any){

            if (((Any)objectIsOn).getType() == Type.BOOLEAN){

                isOn = (Boolean) ((Any)objectIsOn).getObject();

            }

        } else if (objectIsOn instanceof Boolean){

            isOn = (Boolean) objectIsOn;

        }

        if (objectIsShared instanceof Any){

            if (((Any)objectIsShared).getType() == Type.BOOLEAN){

                isShared = (Boolean) ((Any)objectIsShared).getObject();

            }

        } else if (objectIsShared instanceof Boolean){

            isShared = (Boolean) objectIsShared;

        }

        objectIsOn = null;

        objectIsShared = null;

        toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterIsOn,
isOn);


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterIsShared,
isShared);


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterTopBorder,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterTopBorder));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FooterTopBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterTopBorderDistance));

        XText fromXText;

        XText toXText;

        fromXText = (XText) getOOoUnoRuntimeQueryInterface(XText.class,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterText));

        if (isOn.booleanValue() && isShared.booleanValue() && fromXText !=
null && fromXText.getString() != null && !fromXText.getString().isEmpty()){

            toXText = (XText) getOOoUnoRuntimeQueryInterface(XText.class,
toProps.getPropertyValue(PageStyles.PageStyleProperties.FooterText));

            toXText.setString(fromXText.getString());

        }

        fromXText = (XText) getOOoUnoRuntimeQueryInterface(XText.class,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterTextLeft));

        if (isOn.booleanValue() && isShared.booleanValue() && fromXText !=
null && fromXText.getString() != null && !fromXText.getString().isEmpty()){

            toXText = (XText) getOOoUnoRuntimeQueryInterface(XText.class,
toProps.getPropertyValue(PageStyles.PageStyleProperties.FooterTextLeft));

            toXText.setString(fromXText.getString());

        }

        fromXText = (XText) getOOoUnoRuntimeQueryInterface(XText.class,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FooterTextRight));

        if (isOn.booleanValue() && isShared.booleanValue() && fromXText !=
null && fromXText.getString() != null && !fromXText.getString().isEmpty()){

            toXText = (XText) getOOoUnoRuntimeQueryInterface(XText.class,
toProps.getPropertyValue(PageStyles.PageStyleProperties.FooterTextRight));

            toXText.setString(fromXText.getString());

        }

        fromXText = null;

        toXText = null;

    }

    public static void copyPageStyleProperties(XStyle fromStyle, XStyle
toStyle) throws UnknownPropertyException, WrappedTargetException,
PropertyVetoException, IllegalArgumentException {

        XPropertySet fromProps = (XPropertySet)
getOOoUnoRuntimeQueryInterface(XPropertySet.class, fromStyle);

        XPropertySet toProps = (XPropertySet)
getOOoUnoRuntimeQueryInterface(XPropertySet.class, toStyle);

        DocumentWrapper.copyHeaderProperties(fromProps, toProps);

        DocumentWrapper.copyFooterProperties(fromProps, toProps);

        toProps.setPropertyValue(PageStyles.PageStyleProperties.BackColor,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.BackColor));


toProps.setPropertyValue(PageStyles.PageStyleProperties.BackGraphicFilter,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.BackGraphicFilter));


toProps.setPropertyValue(PageStyles.PageStyleProperties.BackGraphicLocation,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.BackGraphicLocation));


toProps.setPropertyValue(PageStyles.PageStyleProperties.BackGraphicURL,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.BackGraphicURL));


toProps.setPropertyValue(PageStyles.PageStyleProperties.BackTransparent,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.BackTransparent));


toProps.setPropertyValue(PageStyles.PageStyleProperties.BorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.BorderDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.BottomBorder,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.BottomBorder));


toProps.setPropertyValue(PageStyles.PageStyleProperties.BottomBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.BottomBorderDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.BottomMargin,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.BottomMargin));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FootnoteHeight,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FootnoteHeight));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FootnoteLineAdjust,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FootnoteLineAdjust));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FootnoteLineColor,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FootnoteLineColor));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FootnoteLineDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FootnoteLineDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FootnoteLineRelativeWidth,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FootnoteLineRelativeWidth));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FootnoteLineTextDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FootnoteLineTextDistance));


toProps.setPropertyValue(PageStyles.PageStyleProperties.FootnoteLineWeight,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.FootnoteLineWeight));


toProps.setPropertyValue(PageStyles.PageStyleProperties.GridBaseHeight,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.GridBaseHeight));


toProps.setPropertyValue(PageStyles.PageStyleProperties.GridBaseWidth,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.GridBaseWidth));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.GridColor,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.GridColor));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.GridDisplay,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.GridDisplay));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.GridLines,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.GridLines));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.GridMode,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.GridMode));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.GridPrint,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.GridPrint));


toProps.setPropertyValue(PageStyles.PageStyleProperties.GridRubyHeight,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.GridRubyHeight));


toProps.setPropertyValue(PageStyles.PageStyleProperties.GridSnapToChars,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.GridSnapToChars));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.Height,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.Height));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.IsLandscape,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.IsLandscape));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.LeftBorder,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.LeftBorder));


toProps.setPropertyValue(PageStyles.PageStyleProperties.LeftBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.LeftBorderDistance));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.LeftMargin,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.LeftMargin));


toProps.setPropertyValue(PageStyles.PageStyleProperties.NumberingType,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.NumberingType));


toProps.setPropertyValue(PageStyles.PageStyleProperties.PageStyleLayout,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.PageStyleLayout));


toProps.setPropertyValue(PageStyles.PageStyleProperties.PrinterPaperTray,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.PrinterPaperTray));


toProps.setPropertyValue(PageStyles.PageStyleProperties.RegisterParagraphStyle,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.RegisterParagraphStyle));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.RightBorder,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.RightBorder));


toProps.setPropertyValue(PageStyles.PageStyleProperties.RightBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.RightBorderDistance));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.RightMargin,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.RightMargin));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.RubyBelow,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.RubyBelow));


toProps.setPropertyValue(PageStyles.PageStyleProperties.ShadowFormat,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.ShadowFormat));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.Size,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.Size));


toProps.setPropertyValue(PageStyles.PageStyleProperties.StandardPageMode,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.StandardPageMode));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.TextColumns,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.TextColumns));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.TopBorder,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.TopBorder));


toProps.setPropertyValue(PageStyles.PageStyleProperties.TopBorderDistance,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.TopBorderDistance));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.TopMargin,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.TopMargin));


toProps.setPropertyValue(PageStyles.PageStyleProperties.UserDefinedAttributes,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.UserDefinedAttributes));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.Width,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.Width));

        toProps.setPropertyValue(PageStyles.PageStyleProperties.WritingMode,
fromProps.getPropertyValue(PageStyles.PageStyleProperties.WritingMode));

        fromProps = null;

        toProps = null;

    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110613/60321364/attachment-0001.htm>


More information about the LibreOffice mailing list