Class DataConvertUtil

java.lang.Object
io.keikai.doc.io.schema.docx.utils.DataConvertUtil

public class DataConvertUtil extends Object
Internal Use Only.

A utility class to convert data between docx and plate.js.

Author:
Jamson Chan
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    A constant representing the default border width in docx (unit in twip), default 4 twip (1/2 pt).
    static final double
    A constant representing the default font size in docx (unit in half-point), default 24 half pt ( = 12 pt).
    static final double
    A constant representing docx's default value of w:spacing -> w:line's, this value divide by the base, will be the default line height ratio 1.15.
    static final double
    A constant representing the width of each paragraph indent-left of docx (unit in twip), will use it to multiply the indent count in plate.js.
    static final double
    A constant representing the base of docx's w:spacing -> w:line's base, w:line's value divide by this value, will be the line height ratio.
    static final Map<org.openxmlformats.schemas.wordprocessingml.x2006.main.STBorder.Enum,io.keikai.doc.api.impl.node.style.TableCellStyle.Border.Style>
    A map to convert docx's border style to plate's.
    static final Map<org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc.Enum,io.keikai.doc.api.impl.node.style.ParagraphStyle.Align>
    A map to convert docx's paragraph alignment to plate's.
    static final Map<org.openxmlformats.schemas.wordprocessingml.x2006.main.STHighlightColor.Enum,String>
    A map to convert docx highlight color(font background color) to the format #RRGGBB.
    static final Map<io.keikai.doc.api.impl.node.style.TableCellStyle.Border.Style,org.openxmlformats.schemas.wordprocessingml.x2006.main.STBorder.Enum>
    A map to convert plate's border style to docx's.
    static final Map<io.keikai.doc.api.impl.node.style.ParagraphStyle.Align,org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc.Enum>
    A map to convert plate's paragraph alignment to docx's.
    static final Map<String,org.openxmlformats.schemas.wordprocessingml.x2006.main.STHighlightColor.Enum>
    A map to convert the format #RRGGBB to docx highlight color(font background color).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.keikai.doc.api.impl.node.style.ParagraphStyle.ListStyleType
    docxNumFmtToListStyleType(org.openxmlformats.schemas.wordprocessingml.x2006.main.STNumberFormat.Enum numFmt, String lvlText)
    Converts a DOCX numbering format and level text to a corresponding list style type.
    static double
    lineHeightToLineSpacing(double height, double minFontSizeOfRuns)
     
    static org.openxmlformats.schemas.wordprocessingml.x2006.main.STNumberFormat.Enum
    listStyleTypeToDocxNumFmt(io.keikai.doc.api.impl.node.style.ParagraphStyle.ListStyleType listStyleType)
    Converts a list style type to a corresponding DOCX numbering format.
    static String
    listStyleTypeToDocxNumLvlText(io.keikai.doc.api.impl.node.style.ParagraphStyle.ListStyleType listStyleType)
    Converts a list style type to a corresponding DOCX level text and ASCII font.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DOCX_P_IND_LEFT

      public static final double DOCX_P_IND_LEFT
      A constant representing the width of each paragraph indent-left of docx (unit in twip), will use it to multiply the indent count in plate.js.
      See Also:
    • DOCX_DEF_FS

      public static final double DOCX_DEF_FS
      A constant representing the default font size in docx (unit in half-point), default 24 half pt ( = 12 pt).
      See Also:
    • DOCX_DEF_BORDER_WIDTH

      public static final double DOCX_DEF_BORDER_WIDTH
      A constant representing the default border width in docx (unit in twip), default 4 twip (1/2 pt).
      See Also:
    • DOCX_SPACING_LINE_BASE

      public static final double DOCX_SPACING_LINE_BASE
      A constant representing the base of docx's w:spacing -> w:line's base, w:line's value divide by this value, will be the line height ratio.
      See Also:
    • DOCX_DEFAULT_LINE_VALUE

      public static final double DOCX_DEFAULT_LINE_VALUE
      A constant representing docx's default value of w:spacing -> w:line's, this value divide by the base, will be the default line height ratio 1.15.
      See Also:
    • DOCX_TO_PLATE_PARAGRAPH_ALIGN

      public static final Map<org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc.Enum,io.keikai.doc.api.impl.node.style.ParagraphStyle.Align> DOCX_TO_PLATE_PARAGRAPH_ALIGN
      A map to convert docx's paragraph alignment to plate's.
      See Also:
      • STJc.Enum
      • ParagraphStyle.Type
    • PLATE_TO_DOCX_PARAGRAPH_ALIGN

      public static final Map<io.keikai.doc.api.impl.node.style.ParagraphStyle.Align,org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc.Enum> PLATE_TO_DOCX_PARAGRAPH_ALIGN
      A map to convert plate's paragraph alignment to docx's.
      See Also:
      • ParagraphStyle.Type
      • STJc.Enum
    • DOCX_TO_PLATE_TEXT_BG_COLOR

      public static final Map<org.openxmlformats.schemas.wordprocessingml.x2006.main.STHighlightColor.Enum,String> DOCX_TO_PLATE_TEXT_BG_COLOR
      A map to convert docx highlight color(font background color) to the format #RRGGBB.
      See Also:
      • STHighlightColor.Enum
    • PLATE_TO_DOCX_TEXT_BG_COLOR

      public static final Map<String,org.openxmlformats.schemas.wordprocessingml.x2006.main.STHighlightColor.Enum> PLATE_TO_DOCX_TEXT_BG_COLOR
      A map to convert the format #RRGGBB to docx highlight color(font background color).
      See Also:
      • STHighlightColor.Enum
    • DOCX_TO_PLATE_BORDER_STYLE

      public static final Map<org.openxmlformats.schemas.wordprocessingml.x2006.main.STBorder.Enum,io.keikai.doc.api.impl.node.style.TableCellStyle.Border.Style> DOCX_TO_PLATE_BORDER_STYLE
      A map to convert docx's border style to plate's.
      See Also:
      • STBorder.Enum
      • TableCellStyle.Border.Style
    • PLATE_TO_DOCX_BORDER_STYLE

      public static final Map<io.keikai.doc.api.impl.node.style.TableCellStyle.Border.Style,org.openxmlformats.schemas.wordprocessingml.x2006.main.STBorder.Enum> PLATE_TO_DOCX_BORDER_STYLE
      A map to convert plate's border style to docx's.
      See Also:
      • TableCellStyle.Border.Style
      • STBorder.Enum
  • Constructor Details

    • DataConvertUtil

      public DataConvertUtil()
  • Method Details

    • lineHeightToLineSpacing

      public static double lineHeightToLineSpacing(double height, double minFontSizeOfRuns)
    • docxNumFmtToListStyleType

      public static io.keikai.doc.api.impl.node.style.ParagraphStyle.ListStyleType docxNumFmtToListStyleType(org.openxmlformats.schemas.wordprocessingml.x2006.main.STNumberFormat.Enum numFmt, String lvlText)
      Converts a DOCX numbering format and level text to a corresponding list style type.
      Parameters:
      numFmt - the DOCX numbering format
      lvlText - the level text
      Returns:
      the corresponding list style type
    • listStyleTypeToDocxNumFmt

      public static org.openxmlformats.schemas.wordprocessingml.x2006.main.STNumberFormat.Enum listStyleTypeToDocxNumFmt(io.keikai.doc.api.impl.node.style.ParagraphStyle.ListStyleType listStyleType)
      Converts a list style type to a corresponding DOCX numbering format.
      Parameters:
      listStyleType - the list style type
      Returns:
      the corresponding DOCX numbering format
    • listStyleTypeToDocxNumLvlText

      public static String listStyleTypeToDocxNumLvlText(io.keikai.doc.api.impl.node.style.ParagraphStyle.ListStyleType listStyleType)
      Converts a list style type to a corresponding DOCX level text and ASCII font.
      Parameters:
      listStyleType - the list style type
      Returns:
      an array containing the DOCX level text and ASCII font