FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV Mobile 2024
→
[WM23] RTF
[WM23] RTF
Débuté par ARV, 17 oct. 2018 19:31 - 3 réponses
Connectez-vous…
ARV
#1
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 17 octobre 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
Signaler
0
0
Rubén Sánchez Peña
#2
Membre enregistré
794 messages
Popularité : +40 (42 votes)
Posté le 18 octobre 2018 - 15:27
Hi. That code depends on the Java Swing libraries to work, and Swing cannot be used on Android.
Rubén
Signaler
0
0
ARV
#3
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 18 octobre 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
Message modifié, 18 octobre 2018 - 17:07
Signaler
0
0
Rubén Sánchez Peña
#4
Membre enregistré
794 messages
Popularité : +40 (42 votes)
Posté le 19 octobre 2018 - 16:47
Maybe
https://stackoverflow.com/questions/19767022/android-edittext-rich-text-formatting
Rubén
Signaler
0
0
→ Revenir à WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte