All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vladsch.flexmark.docx.converter.util.AttributeRunFormatProvider Maven / Gradle / Ivy

There is a newer version: 0.64.8
Show newest version
package com.vladsch.flexmark.docx.converter.util;

import org.docx4j.wml.ParaRPr;
import org.docx4j.wml.RPr;

public class AttributeRunFormatProvider extends RunFormatProviderBase {
    final public AttributeFormat myAttributeFormat;

    public AttributeRunFormatProvider(DocxContext docx, String fontFamily, String fontSize, String fontWeight, String fontStyle, String textColor, String fillColor) {
        super(docx, null, false, null);
        myAttributeFormat = new AttributeFormat(fontFamily, fontSize, fontWeight, fontStyle, textColor, fillColor);
    }

    public AttributeRunFormatProvider(DocxContext docx, AttributeFormat attributeFormat) {
        super(docx, null, false, null);
        myAttributeFormat = attributeFormat;
    }

    @Override
    public void getRPr(RPr rPr) {
        RunFormatProvider parent = myParent;
        if (parent != null) {
            RPr rpr1 = myDocx.getFactory().createRPr();
            parent.getRPr(rpr1);

            inheritParentStyle(rPr, rpr1);
        }

        ParaRPr paraRPr = myDocx.getP().getPPr().getRPr();

        myAttributeFormat.setFormatRPr(rPr, myDocx);
        myDocx.getHelper().keepDiff(rPr, paraRPr);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy