Package words.document

Source Code of words.document.AsposeFormattedText

package words.document;

import java.awt.Color;

import com.aspose.words.Document;
import com.aspose.words.DocumentBuilder;
import com.aspose.words.Font;
import com.aspose.words.ParagraphAlignment;
import com.aspose.words.ParagraphFormat;
import com.aspose.words.Underline;

public class AsposeFormattedText
{
  public static void main(String[] args) throws Exception
  {
    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);
   
    // Set paragraph formatting properties
    ParagraphFormat paragraphFormat = builder.getParagraphFormat();
    paragraphFormat.setAlignment(ParagraphAlignment.CENTER);
    paragraphFormat.setLeftIndent(50);
    paragraphFormat.setRightIndent(50);
    paragraphFormat.setSpaceAfter(25);

    // Output text
    builder.writeln("I'm a very nice formatted paragraph. I'm intended to demonstrate how the left and right indents affect word wrapping.");
   
    // Set font formatting properties
    Font font = builder.getFont();
    font.setBold(true);
    font.setColor(Color.BLUE);
    font.setItalic(true);
    font.setName("Arial");
    font.setSize(24);
    font.setSpacing(5);
    font.setUnderline(Underline.DOUBLE);

    // Output formatted text
    builder.writeln("I'm a very nice formatted string.");

    doc.save("data/Aspose_FormattedText.doc");
   
        System.out.println("Process Completed Successfully");
  }
}
TOP

Related Classes of words.document.AsposeFormattedText

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.