Package org.openxmlformats.schemas.spreadsheetml.x2006.main

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRElt


     * Sets the font of the entire string.
     * @param font          The font to use.
     */
    public void applyFont(Font font) {
        if(st.sizeOfRArray() == 0 && st.isSetT()) {
            CTRElt r = st.addNewR();
            r.setT(st.getT());
            setRunAttributes(((XSSFFont)font).getCTFont(), r.addNewRPr());
            st.unsetT();
        } else {
            CTRElt r = CTRElt.Factory.newInstance();
            r.setT(getString());
            setRunAttributes(((XSSFFont)font).getCTFont(), r.addNewRPr());
            st.setRArray(new CTRElt[]{r});
        }
    }
View Full Code Here


        if(st.sizeOfRArray() == 0 && st.isSetT()) {
            //convert <t>string</t> into a text run: <r><t>string</t></r>
            st.addNewR().setT(st.getT());
            st.unsetT();
        }
        CTRElt lt = st.addNewR();
        lt.setT(text);
        CTRPrElt pr = lt.addNewRPr();
        if(font != null) setRunAttributes(font.getCTFont(), pr);
    }
View Full Code Here

    public int getIndexOfFormattingRun(int index) {
        if(st.sizeOfRArray() == 0) return 0;

        int pos = 0;
        for(int i = 0; i < st.sizeOfRArray(); i++){
            CTRElt r = st.getRArray(i);
            if(i == index) return pos;

            pos += r.getT().length();
        }
        return -1;
    }
View Full Code Here

     */
    public int getLengthOfFormattingRun(int index) {
        if(st.sizeOfRArray() == 0) return length();

        for(int i = 0; i < st.sizeOfRArray(); i++){
            CTRElt r = st.getRArray(i);
            if(i == index) return r.getT().length();
        }
        return -1;
    }
View Full Code Here

     */
    public XSSFFont getFontOfFormattingRun(int index) {
        if(st.sizeOfRArray() == 0) return null;

        for(int i = 0; i < st.sizeOfRArray(); i++){
            CTRElt r = st.getRArray(i);
            if(i == index) return new XSSFFont(toCTFont(r.getRPr()));
        }
        return null;
    }
View Full Code Here

    public XSSFFont getFontAtIndex( int index ) {
        if(st.sizeOfRArray() == 0) return null;

        int pos = 0;
        for(int i = 0; i < st.sizeOfRArray(); i++){
            CTRElt r = st.getRArray(i);
            if(index >= pos && index < pos + r.getT().length()) return new XSSFFont(toCTFont(r.getRPr()));

            pos += r.getT().length();
        }
        return null;

    }
View Full Code Here

     */
    public XSSFFont getFontOfFormattingRun(int index) {
        if(st.sizeOfRArray() == 0) return null;

        for(int i = 0; i < st.sizeOfRArray(); i++){
            CTRElt r = st.getRArray(i);
            if(i == index) {
               XSSFFont fnt = new XSSFFont(toCTFont(r.getRPr()));
               fnt.setThemesTable(getThemesTable());
               return fnt;
            }
        }
        return null;
View Full Code Here

    public XSSFFont getFontAtIndex( int index ) {
        if(st.sizeOfRArray() == 0) return null;

        int pos = 0;
        for(int i = 0; i < st.sizeOfRArray(); i++){
            CTRElt r = st.getRArray(i);
            if(index >= pos && index < pos + r.getT().length()) {
               XSSFFont fnt = new XSSFFont(toCTFont(r.getRPr()));
               fnt.setThemesTable(getThemesTable());
               return fnt;
            }

            pos += r.getT().length();
        }
        return null;

    }
View Full Code Here

        }
        CTRst st = CTRst.Factory.newInstance();
        int runStartIdx = 0;
        for (Iterator<Integer> it = formats.keySet().iterator(); it.hasNext();) {
            int runEndIdx = it.next();
            CTRElt run = st.addNewR();
            String fragment = text.substring(runStartIdx, runEndIdx);
            run.setT(fragment);
            preserveSpaces(run.xgetT());
            CTRPrElt fmt = formats.get(runEndIdx);
            if(fmt != null) run.setRPr(fmt);
            runStartIdx = runEndIdx;
        }
        return st;
    }
View Full Code Here

     * @param font  the font to apply to the appended text or <code>null</code> if no formatting is required
     */
    public void append(String text, XSSFFont font){
        if(st.sizeOfRArray() == 0 && st.isSetT()) {
            //convert <t>string</t> into a text run: <r><t>string</t></r>
            CTRElt lt = st.addNewR();
            lt.setT(st.getT());
            preserveSpaces(lt.xgetT());
            st.unsetT();
        }
        CTRElt lt = st.addNewR();
        lt.setT(text);
        preserveSpaces(lt.xgetT());
        CTRPrElt pr = lt.addNewRPr();
        if(font != null) setRunAttributes(font.getCTFont(), pr);
    }
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRElt

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.