addSVG

addSVG

BASIC / ADVANCED / PREMIUM

Inserts an SVG into the Word document.

Description
public void addSVG(String svg) throws Exception
public void addSVG(String svg, OptionsImage options) throws Exception

This method allows to add an SVG.

Parameters

svg

SVG content.

options

The possible keys and values are:

Key Type Description
borderColor string hexadecimal color: FF0000.
borderStyle string Possible values are:
  • solid
  • dot
  • dash
  • lgDash
  • dashDot
  • lgDashDot
  • lgDashDotDot
  • sysDash
  • sysDot
  • sysDashDot
  • sysDashDotDot
borderWidth int Given in emus (1cm = 360000 emus).
caption array
  • 'bookmarkName' (string) set a custom bookmark name
  • 'color' (string) text color
  • 'label' (string) set a custom label (Figure by default)
  • 'lineSpacing' (int) text line spacing
  • 'showLabel' (bool) show default value Figure
  • 'styleName' (string) allow setting a custom style name, useful to generate table of figures based on style names
  • 'sz' (int) text size
  • 'text' (string) text of the caption
dpi int Dots per inch.
float string (left, right, center) floating image. It only applies if textWrap is not inline (default value).
height int Image height in pixels.
horizontalOffset int Given in emus (1cm = 360000 emus). Only applies if the image is not floating.
hyperlink string Image link.
imageAlign string Image alignment: right, center...
relativeToHorizontal string margin (default), page, column, character, leftMargin, rightMargin, insideMargin, outsideMargin. Not compatible with inline text wrapping.
relativeToVertical string margin, page, line (default), paragraph, topMargin, bottomMargin, insideMargin, outsideMargin. Not compatible with inline text wrapping.
resolution array x, y resolution.
spacingTop int Spacing top in pixels.
spacingBottom int Spacing bottom in pixels.
spacingLeft int Spacing left in pixels.
spacingRight int Spacing right in pixels.
target string document (default value), defaultHeader, firstHeader, evenHeader, defaultFooter, firstFooter, evenFooter, comment, endnote or footnote.
textWrap int Text wrap:
  • 0 (inline)
  • 1 (square)
  • 2 (front)
  • 3 (back)
  • 4 (top and bottom)
  • 5 (clear)
verticalAlign string top, center, bottom. To be used with relativeFromVertical.
verticalOffset int Given in emus (1cm = 360000 emus).
width int Image width in pixels.
Return values

Void.

Code samples

Example #1