PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV Mobile 2024
→
[WM23] RTF
[WM23] RTF
Started by ARV, Oct., 17 2018 7:31 PM - 3 replies
Connect yourself…
ARV
#1
Registered member
498 messages
Popularité : +8 (8 votes)
Posted on October, 17 2018 - 7:31 PM
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
Report
0
0
Rubén Sánchez Peña
#2
Registered member
794 messages
Popularité : +40 (42 votes)
Posted on October, 18 2018 - 3:27 PM
Hi. That code depends on the Java Swing libraries to work, and Swing cannot be used on Android.
Rubén
Report
0
0
ARV
#3
Registered member
498 messages
Popularité : +8 (8 votes)
Posted on October, 18 2018 - 5:07 PM
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 modified, October, 18 2018 - 5:07 PM
Report
0
0
Rubén Sánchez Peña
#4
Registered member
794 messages
Popularité : +40 (42 votes)
Posted on October, 19 2018 - 4:47 PM
Maybe
https://stackoverflow.com/questions/19767022/android-edittext-rich-text-formatting
Rubén
Report
0
0
→ Go back to WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (earlier versions)
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text