Package com.lowagie.text.rtf

Examples of com.lowagie.text.rtf.RtfWriter2


     */
    public static void main(String[] args) {
        System.out.println("Demonstrates creating new, user-defined paragraph stylesheets");
        try {
            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
            // that inherits, but not the other one.
            RtfParagraphStyle.STYLE_NORMAL.setFontName("Times New Roman");
           
View Full Code Here


        System.out.println("Demonstrates setting document settings");
        try {
            Document document = new Document();
           
            // Keep a reference to the RtfWriter2 instance.
            RtfWriter2 writer2 = RtfWriter2.getInstance(document, new FileOutputStream("DocumentSettings.rtf"));
           
            // Specify that the document caching is to be done on disk.
            writer2.getDocumentSettings().setDataCacheStyle(RtfDataCache.CACHE_DISK);
           
            // Specify that all \n are translated into soft linebreaks.
            writer2.getDocumentSettings().setAlwaysGenerateSoftLinebreaks(true);
           
            document.open();
            document.add(new Paragraph("This example has been cached on disk\nand all " +
                    "\\n have been translated into soft linebreaks."));
            document.close();
View Full Code Here

    public static void main(String[] args) {
        System.out.println("Test Suite");

        try {
            Document doc = new Document();
            RtfWriter2 writer2 = RtfWriter2.getInstance(doc,
                    new FileOutputStream("testNew.rtf"));

            writer2.setAutogenerateTOCEntries(true);

            Table headerTable = new Table(3);
            headerTable.addCell("Test Cell 1");
            headerTable.addCell("Test Cell 2");
            headerTable.addCell("Test Cell 3");
View Full Code Here

     */
    public static void main(String[] args) {
        System.out.println("Table of contents and Cell borders");
        Document document = new Document();
        try {
            RtfWriter2 writer2 = RtfWriter2.getInstance(document, new FileOutputStream("toc.rtf"));
           
            writer2.setAutogenerateTOCEntries(true);
           
            document.open();
           
            Paragraph para = new Paragraph();
            para.add(new RtfTableOfContents("RIGHT CLICK AND HERE AND SELECT \"UPDATE FIELD\" TO UPDATE."));
View Full Code Here

TOP

Related Classes of com.lowagie.text.rtf.RtfWriter2

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.