autodrive.formatting.format_rng

Module Contents

Classes

RangeCellFormatting

Contains request generation methods related to formatting a Range's grid

RangeGridFormatting

Contains request generation methods relating to formatting a Range's

RangeTextFormatting

Contains request generation methods methods relating to formatting this

class autodrive.formatting.format_rng.RangeCellFormatting(parent)

Contains request generation methods related to formatting a Range’s grid (width and height, etc).

Parameters

parent (Component[Any, Any, Any]) – A Component object.

add_alternating_row_background(colors)

Queues a request to add an alternating row background of the indicated color to a Range’s cells.

Parameters

colors (Color) – The desired Color to apply to every other row.

Returns

This formatting object, so further requests can be queued if desired.

Return type

RangeCellFormatting

set_background_color(color)

Queues a request to set the background of the Range’s cells to the indicated color.

Parameters

color (Color) – The desired Color to set the background to.

Returns

This formatting object, so further requests can be queued if desired.

Return type

RangeCellFormatting

set_border_format(*sides, style=None, color=None)

Queues a request to set the border properties of the Range’s cells.

Parameters
  • *sides – (BorderSide): One or more BorderSide objects, indicating which side(s) of the cells you want to apply the border properties to. If no sides are provided, set_border_format will apply border properties to all sides.

  • style (BorderStyle, optional) – The style to apply to all the indicated sides. Defaults to None, for the default border style.

  • color (Color, optional) – The color to set the border(s) to. Defaults to None, for black.

Returns

This formatting object, so further requests can be queued if desired.

Return type

RangeCellFormatting

add_request(request)

Adds the passed request to the Formatting object’s parent component.

Parameters

request (Dict[str, Any]) – An api-ready request.

Return type

None

ensure_full_range(rng=None)

Convenience method for ensuring that all requests generated by this Formatting object have a FullRange attached to them, if one isn’t manually supplied.

Parameters

rng (FullRange | str, optional) – A manually generated FullRange, defaults to None.

Returns

The passed FullRange, or a range generated from the Formatting object’s parent Component.

Return type

FullRange

class autodrive.formatting.format_rng.RangeGridFormatting(parent)

Contains request generation methods relating to formatting a Range’s cells (like adding borders and backgrounds and such).

Parameters

parent (Component[Any, Any, Any]) – A Component object.

auto_column_width()

Queues a request to set the column width of the Range’s columns equal to the width of the values in the cells.

Returns

This formatting object, so further requests can be queued if desired.

Return type

RangeGridFormatting

add_request(request)

Adds the passed request to the Formatting object’s parent component.

Parameters

request (Dict[str, Any]) – An api-ready request.

Return type

None

ensure_full_range(rng=None)

Convenience method for ensuring that all requests generated by this Formatting object have a FullRange attached to them, if one isn’t manually supplied.

Parameters

rng (FullRange | str, optional) – A manually generated FullRange, defaults to None.

Returns

The passed FullRange, or a range generated from the Formatting object’s parent Component.

Return type

FullRange

class autodrive.formatting.format_rng.RangeTextFormatting(parent)

Contains request generation methods methods relating to formatting this Range’s text (the text format of any cells, even those containing non-text values like integers or null values).

Parameters

parent (Component[Any, Any, Any]) – A Component object.

apply_format(format)

Queues a request to set the text/number format of the Range’s cells.

Parameters

format (Format) – A format instance, such as TextFormat or NumberFormat.

Returns

This formatting object, so further requests can be queued if desired.

Return type

RangeTextFormatting

set_alignment(*aligns)

Queues a request to set the horizontal and/or vertical text alignment of the Range’s cells.

Parameters

aligns (HorizontalAlign | VerticalAlign) – The desired horizontal and/or vertical alignment properties. Note that if you specify a HorizontalAlign more than once, or a VerticalAlign more than once, only the last of each will be used.

Returns

This formatting object, so further requests can be queued if desired.

Return type

RangeTextFormatting

add_request(request)

Adds the passed request to the Formatting object’s parent component.

Parameters

request (Dict[str, Any]) – An api-ready request.

Return type

None

ensure_full_range(rng=None)

Convenience method for ensuring that all requests generated by this Formatting object have a FullRange attached to them, if one isn’t manually supplied.

Parameters

rng (FullRange | str, optional) – A manually generated FullRange, defaults to None.

Returns

The passed FullRange, or a range generated from the Formatting object’s parent Component.

Return type

FullRange