Package com.scroogexhtml.css
Class CssBuilder
java.lang.Object
com.scroogexhtml.css.CssBuilder
CSS builder.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCharacterStyles
(ParagraphProperties parProps, CharacterProperties charProps) Returns the character styles value.static String
getFontSizeStyle
(int halfPoints, LengthUnit lengthUnit) Returns the font size style value.static String
getParagraphBorderStyle
(BorderStyle borderStyle, String borderColor, int borderWidth) Constructs a CSS border style string based on the specified border style, color, and width.getParagraphStyleCSS
(ParagraphProperties parProps) static int
twipsToPix
(long twips) Convert TWIPS to Pixel.
-
Constructor Details
-
CssBuilder
CSS string builder.- Parameters:
configuration
- the conversion configuration
-
-
Method Details
-
getCharacterStyles
Returns the character styles value.- Parameters:
parProps
- the current paragraph propertiescharProps
- the current character properties- Returns:
- String
-
getParagraphStyleCSS
-
twipsToPix
public static int twipsToPix(long twips) Convert TWIPS to Pixel.- Parameters:
twips
- Number of TWIPS.- Returns:
- Number of pixels.
-
getParagraphBorderStyle
public static String getParagraphBorderStyle(BorderStyle borderStyle, String borderColor, int borderWidth) Constructs a CSS border style string based on the specified border style, color, and width.- Parameters:
borderStyle
- the style of the border, specified as aBorderStyle
enum valueborderColor
- the color of the border specified as a string; if the color is specified as "BLACK_COLOR", it will be omitted in the resulting style stringborderWidth
- the width of the border specified as an integer, which will be formatted with a CSS unit- Returns:
- a formatted CSS border style string (e.g., "1px solid red") or an empty string if the border style
is
NONE
or unrecognized - See Also:
-
getFontSizeStyle
Returns the font size style value.- Parameters:
halfPoints
- int The source font size in half-point.lengthUnit
- The target font size unit.- Returns:
- String The "font-size:..." style definition.
-