public final class HTMLUtils extends Object
The HTMLUtils
class provides utility methods for HTML handling.
Modifier and Type | Method and Description |
---|---|
static String |
htmlToText(String html) |
static String |
toHTML(String s)
Converts chars to html character instructions if necessary.
e.g: < to < |
static String |
toStyle(Font f)
Converts
Font to html stylesheet. |
static String |
toStyle(String fontFamily,
int style,
int size)
Converts
Font to html stylesheet. |
public static String toHTML(String s)
s
- a Stringpublic static String toStyle(Font f)
Font
to html stylesheet.
Examples:
Font font = new Font("Times New Roman", Font.ITALIC, 12);
returns
"font-family:'Times New Roman'; font-style:italic; font-size:12pt;"
This method is a alias for
HTMLUtils.toStyle(f.getFamily(),f.getStyle(),f.getSize());
f
- the Font
of this styletoStyle(String, int, int)
public static String toStyle(String fontFamily, int style, int size)
Font
to html stylesheet.
Examples:
Font font = new Font("Times New Roman", Font.ITALIC, 12);
returns
"font-family:'Times New Roman'; font-style:italic; font-size:12pt;"
fontFamily
- the font family name as String
style
- the font style as int
size
- the font size as int
toStyle(Font)
Copyright © 2003–2021 XDEV Software. All rights reserved.