Class DataConvertUtil


  • public class DataConvertUtil
    extends java.lang.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 double DOCX_DEF_BORDER_WIDTH
      A constant representing the default border width in docx (unit in twip), default 4 twip (1/2 pt).
      static double DOCX_DEF_FS
      A constant representing the default font size in docx (unit in half-point), default 24 half pt ( = 12 pt).
      static 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.
      static java.util.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.
      static java.util.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.
      static java.util.Map<org.openxmlformats.schemas.wordprocessingml.x2006.main.STHighlightColor.Enum,​java.lang.String> DOCX_TO_PLATE_TEXT_BG_COLOR
      A map to convert docx highlight color(font background color) to the format #RRGGBB.
      static java.util.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.
      static java.util.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.
      static java.util.Map<java.lang.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).
    • Constructor Summary

      Constructors 
      Constructor Description
      DataConvertUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double lineHeightToLineSpacing​(double height, double minFontSizeOfRuns)  
      static double lineSpacingToLineHeight​(double line, double minFontSizeOfRuns)  
      • Methods inherited from class java.lang.Object

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

      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • DOCX_TO_PLATE_PARAGRAPH_ALIGN

        public static final java.util.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 java.util.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 java.util.Map<org.openxmlformats.schemas.wordprocessingml.x2006.main.STHighlightColor.Enum,​java.lang.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 java.util.Map<java.lang.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 java.util.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 java.util.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 Detail

      • DataConvertUtil

        public DataConvertUtil()
    • Method Detail

      • lineSpacingToLineHeight

        public static double lineSpacingToLineHeight​(double line,
                                                     double minFontSizeOfRuns)
      • lineHeightToLineSpacing

        public static double lineHeightToLineSpacing​(double height,
                                                     double minFontSizeOfRuns)