Podium.Slide (Podium v0.3.0)

Copy Markdown View Source

Represents a single slide in a presentation.

Slides are created independently with new/1 or new/2, then populated with content using pipe-friendly functions, and finally added to a presentation with Podium.add_slide/2.

Example

slide =
  Podium.Slide.new(:title_content)
  |> Podium.add_chart(:bar, data, x: {1, :in}, y: {2, :in}, width: {8, :in}, height: {4, :in})
  |> Podium.add_image(png, x: {1, :in}, y: {1, :in})
  |> Podium.add_text_box("Hello", x: {1, :in}, y: {6, :in}, width: {4, :in}, height: {1, :in})

prs
|> Podium.add_slide(slide)
|> Podium.save("output.pptx")

Summary

Functions

Adds an auto shape to the slide.

Adds a combo chart to the slide.

Adds a freeform shape to the slide.

Adds an image to the slide.

Adds a text box with a picture fill. The image binary is stored for packaging.

Adds a table to the slide.

Adds a text box shape to the slide.

Adds a video to the slide.

Creates a new slide with the given layout.

Returns the partname for this slide within the package.

Returns the rels partname for this slide.

Sets a picture placeholder on the slide. Stores the placeholder, binary, and extension for later index assignment during serialization.

Generates the slide XML including all shapes, chart graphic frames, and images. chart_rids is a list of {chart, rId} tuples. image_rids is a list of {image, rId} tuples.

Types

t()

@type t() :: %Podium.Slide{
  background: term(),
  background_image: {binary(), String.t()} | nil,
  charts: [Podium.Chart.t()],
  connectors: [Podium.Connector.t()],
  fill_images: [{pos_integer(), binary(), String.t()}],
  images: [Podium.Image.t()],
  index: pos_integer() | nil,
  layout_index: pos_integer() | nil,
  next_shape_id: pos_integer(),
  notes_text: String.t() | nil,
  picture_placeholders: [tuple()],
  placeholders: [Podium.Placeholder.t()],
  pres_rid: String.t() | nil,
  ref: reference() | nil,
  shapes: [Podium.Shape.t()],
  tables: [Podium.Table.t()],
  videos: [Podium.Video.t()]
}

Functions

add_auto_shape(slide, preset, opts)

@spec add_auto_shape(t(), atom(), keyword()) :: t()

Adds an auto shape to the slide.

add_chart(slide, chart_type, chart_data, opts)

@spec add_chart(t(), atom(), struct(), keyword()) :: t()

Adds a chart to the slide.

add_combo_chart(slide, chart_data, plot_specs, opts)

@spec add_combo_chart(
  t(),
  Podium.Chart.ChartData.t(),
  [{atom(), keyword()}],
  keyword()
) :: t()

Adds a combo chart to the slide.

add_connector(slide, connector_type, begin_x, begin_y, end_x, end_y, opts)

Adds a connector to the slide.

add_freeform(slide, fb, opts \\ [])

@spec add_freeform(t(), Podium.Freeform.t(), keyword()) :: t()

Adds a freeform shape to the slide.

add_image(slide, binary, opts)

@spec add_image(t(), binary(), keyword()) :: t()

Adds an image to the slide.

add_picture_fill_text_box(slide, text, image_binary, opts)

@spec add_picture_fill_text_box(t(), Podium.rich_text(), binary(), keyword()) :: t()

Adds a text box with a picture fill. The image binary is stored for packaging.

add_table(slide, rows, opts)

@spec add_table(t(), [[term()]], keyword()) :: t()

Adds a table to the slide.

add_text_box(slide, text, opts)

@spec add_text_box(t(), Podium.rich_text(), keyword()) :: t()

Adds a text box shape to the slide.

add_video(slide, binary, opts)

@spec add_video(t(), binary(), keyword()) :: t()

Adds a video to the slide.

new(layout \\ :blank, opts \\ [])

@spec new(
  Podium.layout(),
  keyword()
) :: t()

Creates a new slide with the given layout.

The first argument is a layout atom or integer index. Options can set the slide background and notes.

Options

  • :background - background fill (hex color, gradient tuple, pattern tuple, or {:picture, binary})
  • :notes - speaker notes text

Available layouts

  • :title_slide (1), :title_content (2), :section_header (3), :two_content (4), :comparison (5), :title_only (6), :blank (7), :content_caption (8), :picture_caption (9), :title_vertical_text (10), :vertical_title_text (11)

partname(slide)

@spec partname(t()) :: String.t()

Returns the partname for this slide within the package.

rels_partname(slide)

@spec rels_partname(t()) :: String.t()

Returns the rels partname for this slide.

set_picture_placeholder(slide, name, binary)

@spec set_picture_placeholder(t(), atom() | {String.t(), non_neg_integer()}, binary()) ::
  t()

Sets a picture placeholder on the slide. Stores the placeholder, binary, and extension for later index assignment during serialization.

The placeholder is addressed either by a bundled-template name or by the layout placeholder's own {type, idx} pair.

to_xml(slide, chart_rids \\ [], image_rids \\ [], fill_rids \\ %{}, hyperlink_rids \\ %{}, bg_rid \\ nil, video_rids \\ [])

@spec to_xml(
  t(),
  [{Podium.Chart.t(), String.t()}],
  [{Podium.Image.t(), String.t()}],
  %{required(pos_integer()) => String.t()},
  %{required(String.t()) => String.t()},
  String.t() | nil,
  [{Podium.Video.t(), String.t(), String.t(), String.t()}]
) :: String.t()

Generates the slide XML including all shapes, chart graphic frames, and images. chart_rids is a list of {chart, rId} tuples. image_rids is a list of {image, rId} tuples.