XLSXComposer.Section (xlsx_composer v0.4.0)

View Source

Elixir.XLSXComposer.Section allows to group cells into units that we can reason and test on that level.

WARNING! : limit number of Sections otherwise the process of the checks might hurt your performance! Soon, implementation of checking of Sections overlap will have to be done so use Section carefully.

Summary

Functions

Find a point just below the area of the section. It should be used to ensure the sections are below each other. It allows opts

Identifies by how much you have to move the x value of the new Section's top_left point to just right another section. Simply: A scenario: you want to find the top_left point of section_2 based of the section_1 (which is a reference here). If section_1 is empty, then section_2 can start from the same top_left, so move by 0. Otherwise, we have to move by 1.

Identifies by how much you have to move the y value of the new Section's top_left point to just below another section. Simply: A scenario: you want to find the top_left point of section_2 based of the section_1 (which is a reference here). If section_1 is empty, then section_2 can start from the same top_left, so move by 0. Otherwise, we have to move by 1.

Find a point just to the right to the area of the section. It should be used to ensure the sections are by each other. It allows opts

Types

area_t()

name_t()

@type name_t() :: String.t()

new_attrs()

@type new_attrs() :: %{
  name: name_t(),
  top_left: XLSXComposer.ExcelCoords.t(),
  cells: XLSXComposer.CellDef.section_cells()
}

t()

@type t() :: %XLSXComposer.Section{
  bottom_right: XLSXComposer.ExcelCoords.t(),
  cells: XLSXComposer.CellDef.section_cells(),
  name: name_t(),
  top_left: XLSXComposer.ExcelCoords.t()
}

Functions

below(section, opts \\ [])

Find a point just below the area of the section. It should be used to ensure the sections are below each other. It allows opts:

  • move_x: integer(), default: 0
  • move_y: non_neg_integer(), default: 0

TL - top left BR - bottom right TB - target below


A1A2A3A4A5
B1TLB3B4B5
C1C2C3C4C5
D1D2D3BRD5
E1TBE3E4E5

move_x_just_right(section)

@spec move_x_just_right(t()) :: 0 | 1

Identifies by how much you have to move the x value of the new Section's top_left point to just right another section. Simply: A scenario: you want to find the top_left point of section_2 based of the section_1 (which is a reference here). If section_1 is empty, then section_2 can start from the same top_left, so move by 0. Otherwise, we have to move by 1.

move_y_just_below(section)

@spec move_y_just_below(t()) :: 0 | 1

Identifies by how much you have to move the y value of the new Section's top_left point to just below another section. Simply: A scenario: you want to find the top_left point of section_2 based of the section_1 (which is a reference here). If section_1 is empty, then section_2 can start from the same top_left, so move by 0. Otherwise, we have to move by 1.

new(args)

@spec new(new_attrs()) :: t()

overlap?(section_1, section_2)

@spec overlap?(t(), t()) :: any()

reduce_to_excel_cells(sections)

@spec reduce_to_excel_cells([t()]) :: XLSXComposer.CellDef.excel_cells()

to_excel_cells(section)

@spec to_excel_cells(t()) :: XLSXComposer.CellDef.excel_cells()

to_the_right(section, opts \\ [])

Find a point just to the right to the area of the section. It should be used to ensure the sections are by each other. It allows opts:

  • move_x: non_neg_integer(), default: 0
  • move_y: integer(), default: 0

TL - top left BR - bottom right TR - target right


A1A2A3A4A5
B1TLB3B4TR
C1C2C3C4C5
D1D2D3BRD5
E1E2E3E4E5