Search in sources :

Example 11 with PredefinedStyle

use of org.olat.core.util.openxml.OpenXMLDocument.PredefinedStyle in project OpenOLAT by OpenOLAT.

the class HTMLToOpenXMLHandler method setImage.

protected void setImage(File file) {
    Element imgEl = factory.createImageEl(file, maxWidthCm);
    if (imgEl != null) {
        PredefinedStyle style = getCurrentPredefinedStyle();
        Element runEl = factory.createRunEl(Collections.singletonList(imgEl), style);
        Element paragrapheEl = getCurrentParagraph(false);
        paragrapheEl.appendChild(runEl);
    }
}
Also used : PredefinedStyle(org.olat.core.util.openxml.OpenXMLDocument.PredefinedStyle) Element(org.w3c.dom.Element)

Example 12 with PredefinedStyle

use of org.olat.core.util.openxml.OpenXMLDocument.PredefinedStyle in project openolat by klemens.

the class HTMLToOpenXMLHandler method getCurrentParagraph.

/**
 * Flush the text if a new paragraph is created. Trailing text is flushed
 * in the previous paragraph.
 * @param create
 * @return
 */
protected Element getCurrentParagraph(boolean create) {
    if (create || currentParagraph == null) {
        // flush the text
        if (textBuffer != null) {
            flushText();
            addContent(currentParagraph);
        }
        Indent indent = getCurrentIndent();
        Border leftBorder = getCurrentLeftBorder();
        PredefinedStyle predefinedStyle = getCurrentPredefinedStyle();
        currentParagraph = factory.createParagraphEl(indent, leftBorder, startSpacing, predefinedStyle);
        // consumed
        startSpacing = null;
    }
    return currentParagraph;
}
Also used : Indent(org.olat.core.util.openxml.OpenXMLDocument.Indent) PredefinedStyle(org.olat.core.util.openxml.OpenXMLDocument.PredefinedStyle) Border(org.olat.core.util.openxml.OpenXMLDocument.Border)

Aggregations

PredefinedStyle (org.olat.core.util.openxml.OpenXMLDocument.PredefinedStyle)12 Element (org.w3c.dom.Element)8 Border (org.olat.core.util.openxml.OpenXMLDocument.Border)6 Indent (org.olat.core.util.openxml.OpenXMLDocument.Indent)6 Node (org.w3c.dom.Node)4