private boolean action_removeSectionWithoutContents(OOComponentHelper ooDoc, String sectionName) { boolean bResult = false; try { XTextSection theSection = ooDocument.getSection(sectionName); XText docText = ooDocument.getTextDocument().getText(); docText.removeTextContent(theSection); bResult = true; } catch (NoSuchElementException ex) { log.error("in removeSectionWIthoutContents : " + ex.getLocalizedMessage(), ex); bResult = false; } finally { return bResult; } }
private boolean action_createRootSection(OOComponentHelper ooDoc, String sectionName) { boolean bResult = false; try { XText docText = ooDocument.getTextDocument().getText(); XTextCursor docCursor = docText.createTextCursor(); docCursor.gotoStart(false); docCursor.gotoEnd(true); XTextContent theContent = ooDocument.createTextSection(sectionName, (short) 1); docText.insertTextContent(docCursor, theContent, true); bResult = true; } catch (IllegalArgumentException ex) { log.error("in action_createRootSection :" + ex.getMessage()); log.error("in action_createRootSection :" + CommonExceptionUtils.getStackTrace(ex)); } finally { return bResult; } }