FOROS PROFESIONALES
WINDEV
,
WEBDEV
y
WINDEV Mobile
Inicio
|
Mensajes recientes
|
Conéctese...
|
Desconectar
|
Español
Inicio
→
WINDEV Mobile 2024
→
[WM23] RTF
[WM23] RTF
Iniciado por ARV, 17,oct. 2018 19:31 - 3 respuestas
Conéctese…
ARV
#1
Miembro registrado
498 mensajes
Popularité : +8 (8 votes)
Publicado el 17,octubre 2018 - 19:31
Hi all
I want to convert RTF to text or HTML I found some thread on the windev forum but I can't get it working
they said that I use this java code on windev
https://www.codeproject.com/Tips/136483/Java-How-to-convert-RTF-into-HTML
for obvious reson I can't copy and paste the exact same code on windev, I do some code for addapting on windev but it doesn't work.
the classes the code call it launch me errors that windev can't find them I don't know what to import I search to import but I can't get it work.
this is my code
import java.io.*;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Desktop;
import java.awt.EventQueue;
import java.awt.Insets;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.EventObject;
import javax.swing.AbstractCellEditor;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.text.AttributeSet;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.html.HTML;
import javax.swing.text.html.HTMLDocument;
public static void prueba(String rtf) throws IOException {
JEditorPane p = new JEditorPane();
p.setContentType("text/rtf");
EditorKit kitRtf = p.getEditorKitForContentType("text/rtf");
try {
kitRtf.read(rtf, p.getDocument(), 0);
kitRtf = null;
EditorKit kitHtml = p.getEditorKitForContentType("text/html");
Writer writer = new StringWriter();
kitHtml.write(writer, p.getDocument(), 0, p.getDocument().getLength());
callWLProcedure_String("ProcedureTest",writer.toString());
//return writer.toString();
} catch (BadLocationException e) {
e.printStackTrace();
}
//return null;
}
someone Know how to solve it?
thanks!
--
Best Regards
ARV
Informar
0
0
Rubén Sánchez Peña
#2
Miembro registrado
795 mensajes
Popularité : +40 (42 votes)
Publicado el 18,octubre 2018 - 15:27
Hi. That code depends on the Java Swing libraries to work, and Swing cannot be used on Android.
Rubén
Informar
0
0
ARV
#3
Miembro registrado
498 mensajes
Popularité : +8 (8 votes)
Publicado el 18,octubre 2018 - 17:07
Hi Rubén
Oh come on!...
so what can I do now?
My text it's on RTF on the DB and I need to show it on android...
thanks for the reply!
--
Best Regards
ARV
Mensaje modificado, 18,octubre 2018 - 17:07
Informar
0
0
Rubén Sánchez Peña
#4
Miembro registrado
795 mensajes
Popularité : +40 (42 votes)
Publicado el 19,octubre 2018 - 16:47
Maybe
https://stackoverflow.com/questions/19767022/android-edittext-rich-text-formatting
Rubén
Informar
0
0
→ Volver a WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versiones precedentes)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Búsqueda Tipo
Sólo temas
Todos los mensajes
Periodo Buscar
Cualquier fecha
Última hora
Última 24 horas
Última semana
Último mes
Último año
Cancelar
Vista previa del mensaje
Añadiendo una imagen
Importar una imagen desde una URL
Enviar una imagen desde un archivo de su disco
Arrastrar un archivo o click en "Examinar..."
o
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto