GOffice.Format

Fields

None

Methods

class

allow_ee_markup ()

class

allow_pi_slash ()

class

allow_si ()

class

default_accounting ()

class

default_date ()

class

default_date_time ()

class

default_money ()

class

default_percentage ()

class

default_time ()

class

empty ()

class

foreach (func, *user_data)

class

general ()

class

generate_number_str (dst, min_digits, num_decimals, thousands_sep, negative_red, negative_paren, prefix, postfix)

class

generate_str (dst, details)

class

locale_currency ()

class

measure_pango (str, layout)

class

measure_strlen (str, layout)

class

measure_zero (str, layout)

class

new_from_XL (str)

class

new_magic (m)

class

new_markup (markup, add_ref)

class

output_to_odf (xout, fmt, cond_part, name, with_extension)

class

palette_color_of_index (i)

class

palette_index_from_color (c)

class

palette_name_of_index (i)

class

str_delocalize (str)

class

str_localize (str)

class

value_gstring (layout, str, measure, metrics, fmt, val, type, sval, go_color, col_width, date_conv, unicode_minus)

as_XL ()

dec_precision ()

eq (b)

get_details ()

get_family ()

get_magic ()

get_markup ()

has_day ()

has_hour ()

has_minute ()

has_month ()

has_year ()

inc_precision ()

is_date ()

is_general ()

is_invalid ()

is_markup ()

is_simple ()

is_text ()

is_time ()

is_var_width ()

month_before_day ()

odf_style_map (cond_part)

ref ()

sel_format_classification ()

specialize (val, type)

toggle_1000sep ()

unref ()

value (val)

Details

class GOffice.Format
classmethod allow_ee_markup()
Return type:

bool

classmethod allow_pi_slash()
Return type:

bool

classmethod allow_si()
Return type:

bool

classmethod default_accounting()
Returns:

the default accounting format

Return type:

GOffice.Format

classmethod default_date()
Returns:

the default date format

Return type:

GOffice.Format

classmethod default_date_time()
Returns:

the default date-and-time format

Return type:

GOffice.Format

classmethod default_money()
Returns:

the default monetary format

Return type:

GOffice.Format

classmethod default_percentage()
Returns:

the default percentage format

Return type:

GOffice.Format

classmethod default_time()
Returns:

the default time format

Return type:

GOffice.Format

classmethod empty()
Returns:

the empty format

Return type:

GOffice.Format

classmethod foreach(func, *user_data)
Parameters:
  • func (GLib.HFunc) – function to execute for each known format

  • user_data (object or None) – user data for func

Executes func for each registered GOffice.Format

classmethod general()
Returns:

the general format

Return type:

GOffice.Format

classmethod generate_number_str(dst, min_digits, num_decimals, thousands_sep, negative_red, negative_paren, prefix, postfix)
Parameters:
  • dst (GLib.String) – GLib.String to append format string to.

  • min_digits (int) – minimum number of digits before decimal separator.

  • num_decimals (int) – number of decimals

  • thousands_sep (bool) – if true, use a thousands separator.

  • negative_red (bool) – if true, make negative values red.

  • negative_paren (bool) – if true, enclose negative values in parentheses.

  • prefix (str) – optional string to place before number part of the format

  • postfix (str) – optional string to place after number part of the format

Generates a format string for a number format with the given parameters and appends it to dst.

classmethod generate_str(dst, details)
Parameters:
classmethod locale_currency()
Returns:

The GOffice.FormatCurrency matches the current locale.

Return type:

GOffice.FormatCurrency

classmethod measure_pango(str, layout)
Parameters:
Return type:

int

classmethod measure_strlen(str, layout)
Parameters:
Return type:

int

classmethod measure_zero(str, layout)
Parameters:
Return type:

int

classmethod new_from_XL(str)
Parameters:

str (str) – XL descriptor in UTF-8 encoding.

Returns:

A GOffice.Format matching str.

Return type:

GOffice.Format

classmethod new_magic(m)
Parameters:

m (GOffice.FormatMagic) –

Return type:

GOffice.Format

classmethod new_markup(markup, add_ref)
Parameters:
Returns:

A new format.

Return type:

GOffice.Format

If add_ref is False absorb the reference to markup, otherwise add a reference.

classmethod output_to_odf(xout, fmt, cond_part, name, with_extension)
Parameters:
Return type:

bool

classmethod palette_color_of_index(i)
Parameters:

i (int) –

Return type:

int

classmethod palette_index_from_color(c)
Parameters:

c (int) – color

Returns:

the index of the color closest to the argument color in some sense.

Return type:

int

classmethod palette_name_of_index(i)
Parameters:

i (int) –

Return type:

str

classmethod str_delocalize(str)
Parameters:

str (str) – A *valid* localized format string

Returns:

a non-local format string, or None if the format was not valid.

Return type:

str or None

De-localizes the given format string, i.e., changes locale’s decimal separators to dots and performs other such transformations.

classmethod str_localize(str)
Parameters:

str (str) – A *valid* format string

Returns:

a localized format string, or None if the format was not valid.

Return type:

str or None

Localizes the given format string, i.e., changes decimal dots to the locale’s notion of that and performs other such transformations.

classmethod value_gstring(layout, str, measure, metrics, fmt, val, type, sval, go_color, col_width, date_conv, unicode_minus)
Parameters:
Returns:

a GOffice.FormatNumberError

Return type:

GOffice.FormatNumberError

Render a floating-point GOffice.value into layout in such a way that the layouting width does not needlessly exceed col_width. Optionally use unicode minus instead of hyphen.

as_XL()
Returns:

the XL style format strint.

Return type:

str

dec_precision()
Returns:

New format, or None if the format would not change.

Return type:

GOffice.Format or None

Decreases the displayed precision for self by one digit.

eq(b)
Parameters:

b (GOffice.Format) –

Return type:

bool

get_details()
Returns:

dst:

GOffice.FormatDetails

exact:

whether dst describes self exactly.

Return type:

(dst: GOffice.FormatDetails, exact: bool)

get_family()
Return type:

GOffice.FormatFamily

get_magic()
Returns:

a non-zero magic code for certain formats, such as system date.

Return type:

GOffice.FormatMagic

get_markup()
Return type:

Pango.AttrList

has_day()
Returns:

True if format is a number format with a day-of-month specifier False otherwise.

Return type:

bool

has_hour()
Returns:

True if format is a number format with an hour specifier False otherwise.

Return type:

bool

has_minute()
Returns:

True if format is a number format with a minute specifier False otherwise.

Return type:

bool

has_month()
Returns:

True if format is a number format with a year specifier False otherwise.

Return type:

bool

has_year()
Returns:

True if format is a number format with a year specifier False otherwise.

Return type:

bool

inc_precision()
Returns:

New format, or None if the format would not change.

Return type:

GOffice.Format or None

Increases the displayed precision for self by one digit.

is_date()
Returns:

+2 if the format is a date format with time +1 if the format is any other date format. 0 if the format is not a date format. -1 if the format is inconsistent.

Return type:

int

is_general()
Returns:

True if the format is “General”, possibly with condition, color, and/or locale. (“xGeneral” is thus not considered to be General for the purpose of this function.) Returns False otherwise.

Return type:

bool

is_invalid()
Returns:

True if, and if only, the format is invalid

Return type:

bool

is_markup()
Returns:

True if the format is a markup format and False otherwise.

Return type:

bool

is_simple()
Return type:

bool

is_text()
Returns:

True if the format is a text format and False otherwise.

Return type:

bool

is_time()
Returns:

+2 if the format is a time format with elapsed hour/minute/second +1 if the format is any other time format 0 if the format is not a time format -1 if the format is inconsistent.

Return type:

int

is_var_width()
Returns:

True if the format is variable width, i.e., can stretch.

Return type:

bool

month_before_day()
Returns:

0, if format is a date format with day and month in that order 1, if format is a date format with month and day in that order, unless 2, if format is a date with year before month before day -1, otherwise.

Return type:

int

odf_style_map(cond_part)
Parameters:

cond_part (int) –

Return type:

str

ref()
Returns:

gf

Return type:

GOffice.Format

Adds a reference to a GOffice.Format.

sel_format_classification()
Return type:

str

specialize(val, type)
Parameters:
  • val (float) – the GOffice.value to use

  • type (int) – the type of GOffice.value; ‘F’ for numeric, ‘B’ for boolean, ‘S’ for string.

Returns:

self format, presumably a conditional format, specialized to value of type.

inhibit_minus:

set to True if the format dictates that a minus should be inhibited when rendering negative values.

Return type:

(GOffice.Format, inhibit_minus: bool)

toggle_1000sep()
Return type:

GOffice.Format

unref()

Removes a reference to self, freeing when it goes to zero.

value(val)
Parameters:

val (float) – GOffice.value to format

Returns:

formatted GOffice.value.

Return type:

str

Converts val into a string using format specified by self.