UmyaSpreadsheet.VmlDrawing (umya_spreadsheet_ex v0.7.0)
View SourceFunctions for working with VML (Vector Markup Language) drawings in Excel files.
VML is a legacy format used in Excel for shapes, comments, and embedded objects. This module allows you to create and manipulate VML shapes in Excel files.
Examples
iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.VmlDrawing.create_shape(spreadsheet, "Sheet1", "shape1")
:ok
iex> UmyaSpreadsheet.VmlDrawing.set_shape_style(spreadsheet, "Sheet1", "shape1", "position:absolute;left:100pt;top:150pt;width:200pt;height:100pt")
:ok
Summary
Functions
Creates a new VML shape in the specified worksheet.
Gets the fill color of a VML shape.
Gets whether a VML shape is filled.
Gets the stroke (outline) color of a VML shape.
Gets the stroke (outline) weight/thickness of a VML shape.
Gets whether a VML shape has a stroke (outline).
Gets the CSS style of a VML shape.
Gets the type of a VML shape.
Sets the fill color of a VML shape.
Sets whether a VML shape is filled.
Sets the stroke (outline) color of a VML shape.
Sets the stroke (outline) weight/thickness of a VML shape.
Sets whether a VML shape has a stroke (outline).
Sets the CSS style for a VML shape.
Sets the type of a VML shape.
Functions
@spec create_shape(UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t()) :: :ok | {:error, String.t()}
Creates a new VML shape in the specified worksheet.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shape
Returns
:ok
on success{:error, reason}
on failure
@spec get_shape_fill_color(UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t()) :: {:ok, String.t()} | {:error, String.t()}
Gets the fill color of a VML shape.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shape
Returns
{:ok, fill_color}
on success where fill_color is a color string (e.g. "#FF0000"){:error, reason}
on failure
@spec get_shape_filled(UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t()) :: {:ok, boolean()} | {:error, String.t()}
Gets whether a VML shape is filled.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shape
Returns
{:ok, filled}
on success where filled is a boolean{:error, reason}
on failure
@spec get_shape_stroke_color(UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t()) :: {:ok, String.t()} | {:error, String.t()}
Gets the stroke (outline) color of a VML shape.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shape
Returns
{:ok, stroke_color}
on success where stroke_color is a color string (e.g. "#0000FF"){:error, reason}
on failure
@spec get_shape_stroke_weight(UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t()) :: {:ok, String.t()} | {:error, String.t()}
Gets the stroke (outline) weight/thickness of a VML shape.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shape
Returns
{:ok, stroke_weight}
on success where stroke_weight is a string (e.g. "2pt"){:error, reason}
on failure
@spec get_shape_stroked(UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t()) :: {:ok, boolean()} | {:error, String.t()}
Gets whether a VML shape has a stroke (outline).
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shape
Returns
{:ok, stroked}
on success where stroked is a boolean{:error, reason}
on failure
@spec get_shape_style(UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t()) :: {:ok, String.t()} | {:error, String.t()}
Gets the CSS style of a VML shape.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shape
Returns
{:ok, style}
on success where style is a CSS style string{:error, reason}
on failure
@spec get_shape_type(UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t()) :: {:ok, String.t()} | {:error, String.t()}
Gets the type of a VML shape.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shape
Returns
{:ok, shape_type}
on success where shape_type is the type (e.g. "rect", "oval", etc.){:error, reason}
on failure
@spec set_shape_fill_color( UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t(), String.t() ) :: :ok | {:error, String.t()}
Sets the fill color of a VML shape.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shapefill_color
- The fill color (e.g. "#FF0000" for red)
Returns
:ok
on success{:error, reason}
on failure
@spec set_shape_filled( UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t(), boolean() ) :: :ok | {:error, String.t()}
Sets whether a VML shape is filled.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shapefilled
- Whether the shape should be filled (boolean)
Returns
:ok
on success{:error, reason}
on failure
@spec set_shape_stroke_color( UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t(), String.t() ) :: :ok | {:error, String.t()}
Sets the stroke (outline) color of a VML shape.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shapestroke_color
- The stroke color (e.g. "#0000FF" for blue)
Returns
:ok
on success{:error, reason}
on failure
@spec set_shape_stroke_weight( UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t(), String.t() ) :: :ok | {:error, String.t()}
Sets the stroke (outline) weight/thickness of a VML shape.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shapestroke_weight
- The stroke weight (e.g. "2pt")
Returns
:ok
on success{:error, reason}
on failure
@spec set_shape_stroked( UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t(), boolean() ) :: :ok | {:error, String.t()}
Sets whether a VML shape has a stroke (outline).
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shapestroked
- Whether the shape should have a stroke (boolean)
Returns
:ok
on success{:error, reason}
on failure
@spec set_shape_style( UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t(), String.t() ) :: :ok | {:error, String.t()}
Sets the CSS style for a VML shape.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shapestyle
- CSS style string (e.g. "position:absolute;left:100pt;top:150pt;width:200pt;height:100pt")
Returns
:ok
on success{:error, reason}
on failure
@spec set_shape_type( UmyaSpreadsheet.Spreadsheet.t(), String.t(), String.t(), String.t() ) :: :ok | {:error, String.t()}
Sets the type of a VML shape.
Parameters
spreadsheet
- A spreadsheet structsheet_name
- The name of the worksheetshape_id
- Unique identifier for the shapeshape_type
- The shape type (e.g. "rect", "oval", "line", etc.)
Returns
:ok
on success{:error, reason}
on failure
Shape Types
Common shape types include:
"rect"
- Rectangle"oval"
- Oval or circle"line"
- Line"polyline"
- Polyline"roundrect"
- Rounded rectangle"arc"
- Arc