Class XLSXFormatter

java.lang.Object
com.nomagic.magicreport.format.DefaultFormatter
com.nomagic.magicreport.format.XLSXFormatter
All Implemented Interfaces:
IFormatter

@OpenApiAll public class XLSXFormatter extends DefaultFormatter
The Velocity engine support for XLSX.
Since:
Dec 9, 2009
  • Constructor Details

    • XLSXFormatter

      public XLSXFormatter(ITemplateEngine templateEngine)
      Create a XLSX formatter with specific properties.
      Parameters:
      templateEngine - template engine
    • XLSXFormatter

      public XLSXFormatter(Properties properties)
      Create a XLSX formatter with specific properties.
      Parameters:
      properties - template properties
  • Method Details

    • format

      public Object format(Object value)
      Convert an Object value into HTML format.
      Specified by:
      format in interface IFormatter
      Overrides:
      format in class DefaultFormatter
      Parameters:
      value - converting value
      Returns:
      object in default format.
    • createChart

      protected ITool.RetainedString createChart(XLSXChart chart) throws IOException
      Create a XLSX chart string from given XLSXChart object.
      Parameters:
      chart - an XLSXChart object
      Returns:
      The String in XLSX chart format.
      Throws:
      IOException - when IO error occurs
    • createImage

      protected ITool.RetainedString createImage(Image image) throws IOException
      Create a DOCX image string from given Image object.
      Parameters:
      image - an Image object
      Returns:
      The String in DOCX image format.
      Throws:
      IOException - when IO error occurs
    • createImage

      protected ITool.RetainedString createImage(Image image, float width, float height, int flag) throws IOException
      Create a DOCX image string from given Image object.
      Parameters:
      image - an Image object
      width - the target image width
      height - the target image height
      flag - scaling image flag
      Returns:
      The String in DOCX image format.
      Throws:
      IOException - when IO error occurs
    • getPageSize

      public float[] getPageSize()
      Get pageSize in Inches.
      Returns:
      pageWidth and pageHeight
    • adjustImage

      protected float[] adjustImage(float w, float h, int flag)
    • adjustImage

      protected float[] adjustImage(Image image, float w, float h, int flag)
      Returns [imageWidth, imageHeight, imageRotate] the image will be rotated if necessary 914,400 EMU per inch 12,700 EMU in a point360,000 EMU per cm.
      Parameters:
      w - image width
      h - image height
      flag - scaling image flag
      Returns:
      the new dimension of image
    • createBookmark

      protected ITool.RetainedString createBookmark(Bookmark bookmark) throws IOException
      Create a XLSX bookmark string from given Bookmark object.
      Parameters:
      bookmark - an Bookmark object
      Returns:
      The String in XLSX bookmark format.
      Throws:
      IOException - when IO error occurs
    • createLink

      protected ITool.RetainedString createLink(Link link) throws IOException
      Create a XLSX link string from given Link object.
      Parameters:
      link - an Link object
      Returns:
      The String in XLSX link format.
      Throws:
      IOException - when IO error occurs
    • createGridSpan

      protected String createGridSpan(GridSpan span)
      Create a XLSX gridspan (merge columns horizontally) string from given GridSpan object.
      Parameters:
      span - an GridSpan object
      Returns:
      The String in PPT for gridspan format.
    • createColumn

      protected String createColumn(Column column)
      Increase new columns from given Column object.
      Parameters:
      column - an Column object
      Returns:
      The String of new columns
    • createGridRowSpan

      protected String createGridRowSpan(GridRowSpan span)
      Create a XLSX gridrowspan (merge columns vertically) string from given GridRowSpan object.
      Parameters:
      span - an GridRowSpan object
      Returns:
      The String in XLSX for gridrowspan format.