Gnm.Workbook

g GObject.Object GObject.Object GOffice.Doc GOffice.Doc GObject.Object->GOffice.Doc Gnm.Workbook Gnm.Workbook GOffice.Doc->Gnm.Workbook

Subclasses:

None

Methods

Inherited:

GOffice.Doc (29), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

attach_view (wbv)

class

cmd_autofit_selection (wbc, sheet, is_cols)

class

cmd_dec_indent (wbc)

class

cmd_inc_indent (wbc)

class

cmd_resize_selected_colrow (wbc, sheet, is_cols, new_size_pixels)

class

cmd_wrap_sort (wbc, type)

class

detach_view (wbv)

class

foreach_cell_in_range (pos, cell_range, flags, handler, closure)

class

new ()

class

new_with_sheets (sheet_count)

class

sheet_delete (sheet)

class

sheet_move (sheet, direction)

cells (comments, vis)

date_conv ()

enable_recursive_dirty (enable)

find_command (is_undo, cmd)

foreach_name (globals_only, func, *data)

get_file_exporter ()

get_file_saver ()

get_last_export_uri ()

get_recalcmode ()

get_sheet_size ()

iteration_enabled (enable)

iteration_max_number (max_number)

iteration_tolerance (tolerance)

mark_dirty ()

optimize_style ()

queue_all_recalc ()

queue_volatile_recalc ()

recalc ()

recalc_all ()

set_1904 (base1904)

set_date_conv (date_conv)

set_file_exporter (fs)

set_last_export_uri (uri)

set_recalcmode (enable)

set_saveinfo (lev, saver)

share_expressions (freeit)

sheet_add (pos, columns, rows)

sheet_add_with_type (sheet_type, pos, columns, rows)

sheet_attach (new_sheet)

sheet_attach_at_pos (new_sheet, pos)

sheet_by_index (i)

sheet_by_name (sheet_name)

sheet_count ()

sheet_get_free_name (base, always_suffix, handle_counter)

sheet_rename (sheet_indices, new_names, cc)

sheet_reorder (new_order)

sheet_state_restore (wss)

sheets ()

update_graphs ()

update_history (type)

Virtual Methods

Inherited:

GObject.Object (7)

do_sheet_added ()

do_sheet_deleted ()

do_sheet_order_changed ()

Properties

Inherited:

GOffice.Doc (7)

Name

Type

Flags

Short Description

being-loaded

bool

r/w

Gnm.Workbook is currently being loaded.

recalc-mode

bool

r/w

Enable automatic recalculation.

Signals

Inherited:

GOffice.Doc (2), GObject.Object (1)

Name

Short Description

sheet-added

sheet-deleted

sheet-order-changed

Fields

Inherited:

GOffice.Doc (2), GObject.Object (1)

Name

Type

Access

Description

doc

GOffice.Doc

r

Class Details

class Gnm.Workbook(**kwargs)
Bases:

GOffice.Doc

Abstract:

No

Structure:

Gnm.WorkbookClass

classmethod attach_view(wbv)
Parameters:

wbv (Gnm.WorkbookView) –

classmethod cmd_autofit_selection(wbc, sheet, is_cols)
Parameters:
classmethod cmd_dec_indent(wbc)
Parameters:

wbc (Gnm.WorkbookControl) –

classmethod cmd_inc_indent(wbc)
Parameters:

wbc (Gnm.WorkbookControl) –

classmethod cmd_resize_selected_colrow(wbc, sheet, is_cols, new_size_pixels)
Parameters:
classmethod cmd_wrap_sort(wbc, type)
Parameters:
classmethod detach_view(wbv)
Parameters:

wbv (Gnm.WorkbookView) –

classmethod foreach_cell_in_range(pos, cell_range, flags, handler, closure)
Parameters:
Returns:

non-None on error, or VALUE_TERMINATE if some the handler requested to stop (by returning non-None).

Return type:

Gnm.Value

The supplied GOffice.value must be a cellrange. The range bounds are calculated relative to the eval position and normalized. For each existing cell in the range specified, invoke the callback routine. If the only_existing flag is True, then callbacks are only invoked for existing cells.

Note: this function does not honour the Gnm.CellIterFlags.IGNORE_SUBTOTAL flag.

classmethod new()
Returns:

A new empty Gnm.Workbook with a unique name.

Return type:

Gnm.Workbook

classmethod new_with_sheets(sheet_count)
Parameters:

sheet_count (int) – initial number of sheets to create.

Returns:

a Gnm.Workbook with sheet_count allocated sheets on it

Return type:

Gnm.Workbook

classmethod sheet_delete(sheet)
Parameters:

sheet (Gnm.Sheet) – the Gnm.Sheet that we want to delete from its GOffice.workbook

This function detaches the given sheet from its parent GOffice.workbook and invalidates all references to the deleted sheet from other sheets and clears all references in the clipboard to this sheet.

classmethod sheet_move(sheet, direction)
Parameters:
  • sheet (Gnm.Sheet) – Gnm.Sheet to move

  • direction (int) – number of spots to move, positive for right and negative for left.

Moves the sheet up or down direction spots in the sheet list If direction is negative, move left. If positive, move right.

cells(comments, vis)
Parameters:
  • comments (bool) – If true, include cells with only comments also.

  • vis (Gnm.SheetVisibility) – How visible a sheet needs to be in order to be considered.

Returns:

the cells array

Return type:

[Gnm.EvalPos]

Collects a GLib.PtrArray of Gnm.EvalPos pointers for all cells in a GOffice.workbook. No particular order should be assumed.

date_conv()
Returns:

the date conventions in effect for the GOffice.workbook.

Return type:

GOffice.DateConventions

enable_recursive_dirty(enable)
Parameters:

enable (bool) –

Return type:

bool

find_command(is_undo, cmd)
Parameters:
Returns:

the 1 based index of the cmd command, or 0 if it is not found (which would be a programmer error).

Return type:

int

foreach_name(globals_only, func, *data)
Parameters:
  • globals_only (bool) – whether to apply only to global names.

  • func (GLib.HFunc) – The operator to apply to each cell.

  • data (object or None) – User data.

get_file_exporter()
Returns:

the exporter for the Gnm.Workbook.

Return type:

GOffice.FileSaver

get_file_saver()
Returns:

the saver for the Gnm.Workbook.

Return type:

GOffice.FileSaver

get_last_export_uri()
Returns:

the URI for export.

Return type:

str

get_recalcmode()
Return type:

bool

get_sheet_size()
Returns:

the current sheet size for self. If sheets are not of uniform size, this will be some size that is big enough in both directions for all sheets. That size isn’t necessarily one that could be used to create a new sheet.

Return type:

Gnm.SheetSize

iteration_enabled(enable)
Parameters:

enable (bool) –

iteration_max_number(max_number)
Parameters:

max_number (int) –

iteration_tolerance(tolerance)
Parameters:

tolerance (float) –

mark_dirty()
optimize_style()
queue_all_recalc()
queue_volatile_recalc()
recalc()

Computes all dependents in self that have been flaged as requiring recomputation.

NOTE! This does not recalc dependents in other workbooks.

recalc_all()

Queues all dependents for recalc and recalculates.

set_1904(base1904)
Parameters:

base1904 (bool) –

set_date_conv(date_conv)
Parameters:

date_conv (GOffice.DateConventions) – new date convention

Sets the date convention date_conv. NOTE : THIS IS NOT A SMART ROUTINE. If you want to actually change this We’ll need to recalc and rerender everything. That will need to be done externally.

set_file_exporter(fs)
Parameters:

fs (GOffice.FileSaver) –

set_last_export_uri(uri)
Parameters:

uri (str) –

set_recalcmode(enable)
Parameters:

enable (bool) –

set_saveinfo(lev, saver)
Parameters:
Returns:

True if save info was set and history may require updating

FIXME : Add a check to ensure the name is unique.

Return type:

bool

If level is sufficiently advanced, assign the info.

share_expressions(freeit)
Parameters:

freeit (bool) –

Return type:

Gnm.ExprSharer

sheet_add(pos, columns, rows)
Parameters:
  • pos (int) – position to add, -1 meaning at end.

  • columns (int) – the sheet columns number.

  • rows (int) – the sheet rows number.

Returns:

the new sheet.

Return type:

Gnm.Sheet

Create and name a new sheet, putting it at position pos. The sheet returned is not ref’d. (The ref belongs to the GOffice.workbook.)

sheet_add_with_type(sheet_type, pos, columns, rows)
Parameters:
  • sheet_type (Gnm.SheetType) – the sheet type.

  • pos (int) – position to add, -1 meaning append.

  • columns (int) – the sheet columns number.

  • rows (int) – the sheet rows number.

Returns:

the new sheet.

Return type:

Gnm.Sheet

Create and name a new sheet, putting it at position pos. The sheet returned is not ref’d. (The ref belongs to the GOffice.workbook.)

sheet_attach(new_sheet)
Parameters:

new_sheet (Gnm.Sheet) – A Gnm.Sheet to attach

Add new_sheet to self, placing it at the end. SURPRISE: This assumes a ref to the sheet.

sheet_attach_at_pos(new_sheet, pos)
Parameters:
  • new_sheet (Gnm.Sheet) – A Gnm.Sheet

  • pos (int) – position to attach new_sheet at, -1 meaning at the end

Add new_sheet to self, placing it at pos.

sheet_by_index(i)
Parameters:

i (int) – the sheet index we are looking for.

Returns:

A Gnm.Sheet

Return type:

Gnm.Sheet or None

sheet_by_name(sheet_name)
Parameters:

sheet_name (str) – the sheet name we are looking for. This is case insensitive.

Returns:

A Gnm.Sheet

Return type:

Gnm.Sheet or None

sheet_count()
Return type:

int

sheet_get_free_name(base, always_suffix, handle_counter)
Parameters:
  • base (str) – base for the name, e. g. “Gnm.Sheet"

  • always_suffix (bool) – if true, add suffix even if the name “base” is not in use.

  • handle_counter (bool) – strip counter if necessary

Returns:

a unique sheet name

Return type:

str

Gets a new unquoted name for a sheets such that it does not exist on the GOffice.workbook.

sheet_rename(sheet_indices, new_names, cc)
Parameters:
  • sheet_indices ([int]) – list of sheet indices (ignore -1)

  • new_names ([str]) – list of new names

  • cc (GOffice.CmdContext) –

Returns:

False when it was successful

Return type:

bool

Adjusts the names of the sheets. We assume that everything is valid. If in doubt call workbook_sheet_reorder_check first.

sheet_reorder(new_order)
Parameters:

new_order ([Gnm.Sheet]) – list of Gnm.Sheet

Return type:

bool

Adjusts the order of the sheets.

Returns False when it was successful

sheet_state_restore(wss)
Parameters:

wss (Gnm.WorkbookSheetState) –

sheets()
Returns:

the sheets list.

Return type:

[Gnm.Sheet]

Get an ordered list of the sheets in the GOffice.workbook

update_graphs()
update_history(type)
Parameters:

type (Gnm.FileSaveAsStyle) –

do_sheet_added() virtual
do_sheet_deleted() virtual
do_sheet_order_changed() virtual

Signal Details

Gnm.Workbook.signals.sheet_added(workbook)
Signal Name:

sheet-added

Flags:

RUN_LAST

Parameters:

workbook (Gnm.Workbook) – The object which received the signal

Gnm.Workbook.signals.sheet_deleted(workbook)
Signal Name:

sheet-deleted

Flags:

RUN_LAST

Parameters:

workbook (Gnm.Workbook) – The object which received the signal

Gnm.Workbook.signals.sheet_order_changed(workbook)
Signal Name:

sheet-order-changed

Flags:

RUN_LAST

Parameters:

workbook (Gnm.Workbook) – The object which received the signal

Property Details

Gnm.Workbook.props.being_loaded
Name:

being-loaded

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Gnm.Workbook is currently being loaded.

Gnm.Workbook.props.recalc_mode
Name:

recalc-mode

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Enable automatic recalculation.