Class CssBuilder

java.lang.Object
com.scroogexhtml.css.CssBuilder

public class CssBuilder extends Object
CSS builder.
  • Constructor Details

    • CssBuilder

      public CssBuilder(ConversionConfiguration configuration)
      CSS string builder.
      Parameters:
      configuration - the conversion configuration
  • Method Details

    • getCharacterStyles

      public String getCharacterStyles(ParagraphProperties parProps, CharacterProperties charProps)
      Returns the character styles value.
      Parameters:
      parProps - the current paragraph properties
      charProps - the current character properties
      Returns:
      String
    • getParagraphStyleCSS

      public String getParagraphStyleCSS(ParagraphProperties parProps)
    • 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 a BorderStyle enum value
      borderColor - 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 string
      borderWidth - 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

      public static String getFontSizeStyle(int halfPoints, LengthUnit lengthUnit)
      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.