Java Utililty Methods Swing RTF

List of utility methods to do Swing RTF

  1. HOME
  2. Java
  3. S
  4. Swing RTF

Description

The list of methods to do Swing RTF are organized into topic(s).

Method

String RTF2TXT(String Str)
RTFTXT
if (Str != null && Str.startsWith("{\\rtf1") == true) {
 Str = RTF_CELL_PATTERN.matcher(Str).replaceAll(". 0ドル");
 RTFEditorKit RTF = new RTFEditorKit();
 Document doc = RTF.createDefaultDocument();
 RTF.read(new StringReader(Str), doc, 0);
 Str = doc.getText(0, doc.getLength());
return Str;
...
String rtfToPlain(String rtf)
rtf To Plain
RTFEditorKit rtfParser = new RTFEditorKit();
Document document = rtfParser.createDefaultDocument();
try {
 rtfParser.read(new ByteArrayInputStream(rtf.getBytes()), document, 0);
 return document.getText(0, document.getLength());
} catch (Exception e) {
 throw new RuntimeException("Error converting RTF to plain text", e);

AltStyle によって変換されたページ (->オリジナル) /