Examples of RtfParagraphStyle


Examples of com.lowagie.text.rtf.style.RtfParagraphStyle

        if(paragraph.getFont() instanceof RtfParagraphStyle) {
            this.paragraphStyle = this.document.getDocumentHeader().getRtfParagraphStyle(((RtfParagraphStyle) paragraph.getFont()).getStyleName());
            baseFont = this.paragraphStyle;
        } else {
            baseFont = new RtfFont(this.document, paragraph.getFont());
            this.paragraphStyle = new RtfParagraphStyle(this.document, this.document.getDocumentHeader().getRtfParagraphStyle("Normal"));
            this.paragraphStyle.setAlignment(paragraph.getAlignment());
            this.paragraphStyle.setFirstLineIndent((int) (paragraph.getFirstLineIndent() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setIndentLeft((int) (paragraph.getIndentationLeft() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setIndentRight((int) (paragraph.getIndentationRight() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setSpacingBefore((int) (paragraph.getSpacingBefore() * RtfElement.TWIPS_FACTOR));
 
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfParagraphStyle

            LwgDocument document = new LwgDocument();
            RtfWriter2 writer = RtfWriter2.getInstance(document, new FileOutputStream("ExtendingStylesheets.rtf"));

            // Create the new RtfParagraphStyle. The second parameter is the name of
            // the RtfParagraphStyle that this style will inherit default properties from.
            RtfParagraphStyle incorrectStyle = new RtfParagraphStyle("Incorrect", "Normal");
            // Change the desired properties
            incorrectStyle.setColor(Color.RED);
            incorrectStyle.setStyle(LwgFont.STRIKETHRU);
            // Register the new paragraph stylesheet with the RtfWriter2.
            writer.getDocumentSettings().registerParagraphStyle(incorrectStyle);
           
            // Create a new RtfParagraphStyle that does not inherit from any other style.
            RtfParagraphStyle correctStyle = new RtfParagraphStyle("Correct", "Arial",
                    12, LwgFont.NORMAL, Color.GREEN);
            // Register the new paragraph stylesheet with the RtfWriter2.
            writer.getDocumentSettings().registerParagraphStyle(correctStyle);

            // Change the default font name. This will propagate to the paragraph stylesheet
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfParagraphStyle

            LwgDocument document = new LwgDocument();
            RtfWriter2 rtfWriter2 = RtfWriter2.getInstance(document, new FileOutputStream("TableOfContents.rtf"));

            // Create paragraph stylesheets for each heading level. They must be named
            // "toc N" for each heading level you are using
            RtfParagraphStyle tocLevel1Style = new RtfParagraphStyle("toc 1",
                    "Times New Roman", 11, LwgFont.NORMAL, Color.BLACK);
            RtfParagraphStyle tocLevel2Style = new RtfParagraphStyle("toc 2",
                    "Times New Roman", 10, LwgFont.NORMAL, Color.BLACK);
            tocLevel2Style.setIndentLeft(10);
           
            // Register the paragraph stylesheets with the RtfWriter2
            rtfWriter2.getDocumentSettings().registerParagraphStyle(tocLevel1Style);
            rtfWriter2.getDocumentSettings().registerParagraphStyle(tocLevel2Style);
           
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfParagraphStyle

    paragraph.setAlignment(1);
    paragraph2.setAlignment(1);
    document.add(paragraph);
    document.add(paragraph2);
    // 加Table of Content
    RtfParagraphStyle tocLevel1Style = new RtfParagraphStyle("toc 1",
        "Times New Roman", 11, Font.NORMAL, Color.BLACK);
    RtfParagraphStyle tocLevel2Style = new RtfParagraphStyle("toc 2",
        "Times New Roman", 10, Font.NORMAL, Color.BLACK);
    tocLevel2Style.setIndentLeft(10);

    // Register the paragraph stylesheets with the RtfWriter2
    rtfWriter2.getDocumentSettings().registerParagraphStyle(tocLevel1Style);
    rtfWriter2.getDocumentSettings().registerParagraphStyle(tocLevel2Style);
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfParagraphStyle

        if(paragraph.getFont() instanceof RtfParagraphStyle) {
            this.paragraphStyle = this.document.getDocumentHeader().getRtfParagraphStyle(((RtfParagraphStyle) paragraph.getFont()).getStyleName());
            baseFont = this.paragraphStyle;
        } else {
            baseFont = new RtfFont(this.document, paragraph.getFont());
            this.paragraphStyle = new RtfParagraphStyle(this.document, this.document.getDocumentHeader().getRtfParagraphStyle("Normal"));
            this.paragraphStyle.setAlignment(paragraph.getAlignment());
            this.paragraphStyle.setFirstLineIndent((int) (paragraph.getFirstLineIndent() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setIndentLeft((int) (paragraph.getIndentationLeft() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setIndentRight((int) (paragraph.getIndentationRight() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setSpacingBefore((int) (paragraph.getSpacingBefore() * RtfElement.TWIPS_FACTOR));
 
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfParagraphStyle

        if(paragraph.getFont() instanceof RtfParagraphStyle) {
            this.paragraphStyle = this.document.getDocumentHeader().getRtfParagraphStyle(((RtfParagraphStyle) paragraph.getFont()).getStyleName());
            baseFont = this.paragraphStyle;
        } else {
            baseFont = new RtfFont(this.document, paragraph.getFont());
            this.paragraphStyle = new RtfParagraphStyle(this.document, this.document.getDocumentHeader().getRtfParagraphStyle("Normal"));
            this.paragraphStyle.setAlignment(paragraph.getAlignment());
            this.paragraphStyle.setFirstLineIndent((int) (paragraph.getFirstLineIndent() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setIndentLeft((int) (paragraph.getIndentationLeft() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setIndentRight((int) (paragraph.getIndentationRight() * RtfElement.TWIPS_FACTOR));
            this.paragraphStyle.setSpacingBefore((int) (paragraph.spacingBefore() * RtfElement.TWIPS_FACTOR));
 
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfParagraphStyle

            Document document = new Document();
            RtfWriter2 rtfWriter2 = RtfWriter2.getInstance(document, new FileOutputStream("TableOfContents.rtf"));

            // Create paragraph stylesheets for each heading level. They must be named
            // "toc N" for each heading level you are using
            RtfParagraphStyle tocLevel1Style = new RtfParagraphStyle("toc 1",
                    "Times New Roman", 11, Font.NORMAL, Color.BLACK);
            RtfParagraphStyle tocLevel2Style = new RtfParagraphStyle("toc 2",
                    "Times New Roman", 10, Font.NORMAL, Color.BLACK);
            tocLevel2Style.setIndentLeft(10);
           
            // Register the paragraph stylesheets with the RtfWriter2
            rtfWriter2.getDocumentSettings().registerParagraphStyle(tocLevel1Style);
            rtfWriter2.getDocumentSettings().registerParagraphStyle(tocLevel2Style);
           
View Full Code Here

Examples of com.lowagie.text.rtf.style.RtfParagraphStyle

            Document document = new Document();
            RtfWriter2 writer = RtfWriter2.getInstance(document, new FileOutputStream("ExtendingStylesheets.rtf"));

            // Create the new RtfParagraphStyle. The second parameter is the name of
            // the RtfParagraphStyle that this style will inherit default properties from.
            RtfParagraphStyle incorrectStyle = new RtfParagraphStyle("Incorrect", "Normal");
            // Change the desired properties
            incorrectStyle.setColor(Color.RED);
            incorrectStyle.setStyle(Font.STRIKETHRU);
            // Register the new paragraph stylesheet with the RtfWriter2.
            writer.getDocumentSettings().registerParagraphStyle(incorrectStyle);
           
            // Create a new RtfParagraphStyle that does not inherit from any other style.
            RtfParagraphStyle correctStyle = new RtfParagraphStyle("Correct", "Arial",
                    12, Font.NORMAL, Color.GREEN);
            // Register the new paragraph stylesheet with the RtfWriter2.
            writer.getDocumentSettings().registerParagraphStyle(correctStyle);

            // Change the default font name. This will propagate to the paragraph stylesheet
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.