Package javax.swing.text.rtf

Examples of javax.swing.text.rtf.RTFEditorKit


{
  private RTFEditorKit editorKit;

  public RtfRichTextConverter()
  {
    editorKit = new RTFEditorKit();
  }
View Full Code Here


   *
   * @throws RegainException Wenn die Pr�paration fehl schlug.
   */
  public void prepare(RawDocument rawDocument) throws RegainException {
    if (mRTFEditorKit == null) {
      mRTFEditorKit = new RTFEditorKit();
    }

    InputStream stream = null;
    try {
      stream = rawDocument.getContentAsStream();
View Full Code Here

            throws Parser.Failure, InterruptedException {

        try
            final DefaultStyledDocument doc = new DefaultStyledDocument();
           
            final RTFEditorKit theRtfEditorKit = new RTFEditorKit();              
            theRtfEditorKit.read(source, doc, 0);           
           
            final String bodyText = doc.getText(0, doc.getLength());
           
            return new Document[]{new Document(
                    location,
View Full Code Here

public class DefaultRtfDocumentHandler extends AbstractTypeFileDocumentHandler {

  protected String extractText(InputStream inputStream) throws IOException {
    DefaultStyledDocument styledDoc = new DefaultStyledDocument();
    try {
      new RTFEditorKit().read(inputStream, styledDoc, 0);
      return styledDoc.getText(0, styledDoc.getLength());
    } catch(BadLocationException ex) {
      ex.printStackTrace();
    }
    return null;
View Full Code Here

        InputStream isr = null;
        try {
            isr = new FileInputStream(pathToFile);
            String fileContent = "";
            String fileContentForLanguageDetermination = "";
            RTFEditorKit RTFEditorKit = new RTFEditorKit();
            Document RTFdoc = RTFEditorKit.createDefaultDocument();
            String lang = "";

            RTFEditorKit.read(isr, RTFdoc, 0);
            fileContent = RTFdoc.getText(0, RTFdoc.getLength()).trim();

            fileContentForLanguageDetermination =
                    new String(fileContent.getBytes("ISO-8859-1"), "cp1251");
View Full Code Here

            InputStream stream, ContentHandler handler,
            Metadata metadata, ParseContext context)
            throws IOException, SAXException, TikaException {
        try {
            DefaultStyledDocument sd = new DefaultStyledDocument();
            new RTFEditorKit().read(stream, sd, 0);

            XHTMLContentHandler xhtml =
                new XHTMLContentHandler(handler, metadata);
            xhtml.startDocument();
            xhtml.element("p", sd.getText(0, sd.getLength()));
View Full Code Here

      }
    }
  }

  private String convert(InputStream rtfDocumentInputStream) throws IOException {
    RTFEditorKit aRtfEditorkit = new RTFEditorKit();

    StyledDocument styledDoc = new DefaultStyledDocument();

    String textDocument;

    try {
      aRtfEditorkit.read(rtfDocumentInputStream, styledDoc, 0);

      textDocument = styledDoc.getText(0, styledDoc.getLength());
    } catch (BadLocationException e) {
      throw new IOException("Error during parsing");
    }
View Full Code Here

    String ret = null;
    //creating a default blank styled document
    DefaultStyledDocument styledDoc = new DefaultStyledDocument();

    //Creating a RTF Editor kit
    RTFEditorKit rtfKit = new RTFEditorKit();

    //Populating the contents in the blank styled document
    try {
      rtfKit.read(is, styledDoc, 0);

      // Getting the root document
      Document doc = styledDoc.getDefaultRootElement().getDocument();

      //Printing out the contents of the RTF document as plain text
View Full Code Here

      }
    }
  }

  private String convert(InputStream rtfDocumentInputStream) throws IOException {
    RTFEditorKit aRtfEditorkit = new RTFEditorKit();

    StyledDocument styledDoc = new DefaultStyledDocument();

    String textDocument;

    try {
      aRtfEditorkit.read(rtfDocumentInputStream, styledDoc, 0);

      textDocument = styledDoc.getText(0, styledDoc.getLength());
    } catch (BadLocationException e) {
      throw new IOException("Error during parsing");
    }
View Full Code Here

            (JEditorPane.createEditorKitForContentType("foobar").getClass(),
             HTMLEditorKit.class);

          // Explicitly setting the EditorKit takes precedence over the
          // registered type
          pane.setEditorKitForContentType ("foobar", new RTFEditorKit());
          harness.check
            (pane.getEditorKitForContentType("foobar").getClass(),
             RTFEditorKit.class);  

          // We can set the EditorKit for content types previously unintroduced
          pane.setEditorKitForContentType ("tony", new RTFEditorKit());
          harness.check
            (pane.getEditorKitForContentType("tony").getClass(),
             RTFEditorKit.class);  
          // But this only affects the instance of JEditorPane, not the class itself
          harness.check (JEditorPane.createEditorKitForContentType("tony") == null);
View Full Code Here

TOP

Related Classes of javax.swing.text.rtf.RTFEditorKit

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.