excelizer v0.1.2 Excelizer.Image.Format

module to manage a struct for Excelizer.Image module

Link to this section Summary

Types

t()

struct for Excelizer.Image module

Functions

convert Format struct to json string ## Example

Link to this section Types

Specs

t() :: %Excelizer.Image.Format{
  hyperlink: nil | String.t(),
  hyperlink_type: nil | :external | :location,
  lock_aspect_ratio: boolean(),
  locked: boolean(),
  positioning: nil | :one_cell | :absolute,
  print_obj: boolean(),
  x_offset: nil | number(),
  x_scale: nil | number(),
  y_offset: nil | number(),
  y_scale: nil | number()
}

struct for Excelizer.Image module

  • x_scale / y_scale: scale for x/y axis
  • x_offset / y_offset: offset for x/y axis
  • print_obj: printing an attached image
  • lock_aspect_ratio: if true, lock aspect ratio of an attached image
  • locked: if true, users can't modify an attached image,
  • positioning: :one_cell → (Move but don't size with cells). :absolute → (Don't move or size with cells). If you don't set this parameter, default positioning is move and size with cells.
  • hyperlink: if you set, you can add a hyperlink to an attached image,
  • hyperlink_type: :external → link for external source :location → link for internal excel location. When you use it, coordinates need to start with #.

Link to this section Functions

Link to this function

convert_to_json(data)

Specs

convert_to_json(t()) :: String.t()

convert Format struct to json string ## Example

  iex> data = convert_to_json(%Excelizer.Image.Format{})
  iex> Poison.decode!(data)
  %{
    "hyperlink" => nil,
    "hyperlink_type" => nil,
    "lock_aspect_ratio" => false,
    "locked" => false,
    "positioning" => nil,
    "print_obj" => false,
    "x_offset" => nil,
    "x_scale" => nil,
    "y_offset" => nil,
    "y_scale" => nil
  }

  iex> data = convert_to_json(%Excelizer.Image.Format{positioning: :one_cell, hyperlink_type: :external})
  iex> Poison.decode!(data)
  %{
    "hyperlink" => nil,
    "hyperlink_type" => "External",
    "lock_aspect_ratio" => false,
    "locked" => false,
    "positioning" => "oneCell",
    "print_obj" => false,
    "x_offset" => nil,
    "x_scale" => nil,
    "y_offset" => nil,
    "y_scale" => nil
  }

  iex> data = convert_to_json(%Excelizer.Image.Format{positioning: :absolute, hyperlink_type: :location})
  iex> Poison.decode!(data)
  %{
    "hyperlink" => nil,
    "hyperlink_type" => "Location",
    "lock_aspect_ratio" => false,
    "locked" => false,
    "positioning" => "absolute",
    "print_obj" => false,
    "x_offset" => nil,
    "x_scale" => nil,
    "y_offset" => nil,
    "y_scale" => nil
  }