/** * Create child element {@odf.element style:master-page}. * * @param styleNameValue the <code>String</code> value of <code>StyleNameAttribute</code>, see {@odf.attribute style:name} at specification * @param stylePageLayoutNameValue the <code>String</code> value of <code>StylePageLayoutNameAttribute</code>, see {@odf.attribute style:page-layout-name} at specification * @return the element {@odf.element style:master-page} */ public StyleMasterPageElement newStyleMasterPageElement(String styleNameValue, String stylePageLayoutNameValue) { StyleMasterPageElement styleMasterPage = ((OdfFileDom) this.ownerDocument).newOdfElement(StyleMasterPageElement.class); styleMasterPage.setStyleNameAttribute(styleNameValue); styleMasterPage.setStylePageLayoutNameAttribute(stylePageLayoutNameValue); this.appendChild(styleMasterPage); return styleMasterPage; }
/** * Create child element {@odf.element style:master-page}. * * @param styleNameValue the <code>String</code> value of <code>StyleNameAttribute</code>, see {@odf.attribute style:name} at specification * @param stylePageLayoutNameValue the <code>String</code> value of <code>StylePageLayoutNameAttribute</code>, see {@odf.attribute style:page-layout-name} at specification * @return the element {@odf.element style:master-page} */ public StyleMasterPageElement newStyleMasterPageElement(String styleNameValue, String stylePageLayoutNameValue) { StyleMasterPageElement styleMasterPage = ((OdfFileDom) this.ownerDocument).newOdfElement(StyleMasterPageElement.class); styleMasterPage.setStyleNameAttribute(styleNameValue); styleMasterPage.setStylePageLayoutNameAttribute(stylePageLayoutNameValue); this.appendChild(styleMasterPage); return styleMasterPage; }
/** * Create child element {@odf.element style:master-page}. * * @param styleNameValue the <code>String</code> value of <code>StyleNameAttribute</code>, see {@odf.attribute style:name} at specification * @param stylePageLayoutNameValue the <code>String</code> value of <code>StylePageLayoutNameAttribute</code>, see {@odf.attribute style:page-layout-name} at specification * @return the element {@odf.element style:master-page} */ public StyleMasterPageElement newStyleMasterPageElement(String styleNameValue, String stylePageLayoutNameValue) { StyleMasterPageElement styleMasterPage = ((OdfFileDom) this.ownerDocument).newOdfElement(StyleMasterPageElement.class); styleMasterPage.setStyleNameAttribute(styleNameValue); styleMasterPage.setStylePageLayoutNameAttribute(stylePageLayoutNameValue); this.appendChild(styleMasterPage); return styleMasterPage; }
/** * Return a master page according to its name and its document. * <p> * If there is no existing master page defined by this name in the document, * a new master with this name will be created and returned. * * @param doc * - the document to which the master page belongs. * @param name * - the name of the master page * @return a master page * @throws Exception * if the style DOM cannot be initialized */ public static MasterPage getOrCreateMasterPage(Document doc, String name) throws Exception { OdfOfficeMasterStyles officeMasterStyles = doc.getOfficeMasterStyles(); StyleMasterPageElement master = officeMasterStyles.getMasterPage(name); if (master == null) { master = doc.getStylesDom().newOdfElement( StyleMasterPageElement.class); master.setStyleNameAttribute(name); officeMasterStyles.appendChild(master); } return new MasterPage(master); }
/** * Return a master page according to its name and its document. * <p> * If there is no existing master page defined by this name in the document, * a new master with this name will be created and returned. * * @param doc * - the document to which the master page belongs. * @param name * - the name of the master page * @return a master page * @throws Exception * if the style DOM cannot be initialized */ public static MasterPage getOrCreateMasterPage(Document doc, String name) throws Exception { OdfOfficeMasterStyles officeMasterStyles = doc.getOfficeMasterStyles(); StyleMasterPageElement master = officeMasterStyles.getMasterPage(name); if (master == null) { master = doc.getStylesDom().newOdfElement( StyleMasterPageElement.class); master.setStyleNameAttribute(name); officeMasterStyles.appendChild(master); } return new MasterPage(master); }