Spreadsheet Document

Document

class document : public orcus::iface::document_dumper

Internal document representation used only for testing the filters. It uses ixion’s model_context implementation to store raw cell values.

Public Functions

document(const document&)
document &operator=(const document&)
document()
~document()
import_shared_strings *get_shared_strings()
const import_shared_strings *get_shared_strings() const
styles &get_styles()
const styles &get_styles() const
pivot_collection &get_pivot_collection()
const pivot_collection &get_pivot_collection() const
sheet *append_sheet(const pstring &sheet_name, row_t row_size, col_t col_size)
sheet *get_sheet(const pstring &sheet_name)
const sheet *get_sheet(const pstring &sheet_name) const
sheet *get_sheet(sheet_t sheet_pos)
const sheet *get_sheet(sheet_t sheet_pos) const
void calc_formulas()
void clear()

Clear document content, to make it empty.

virtual void dump_flat(const std::string &outdir) const

Dump document content to specified output directory.

virtual void dump_html(const std::string &outdir) const

File name should not contain an extension. The final name will be [filename] + _ + [sheet name] + .html.

Parameters
  • filename: base file name

virtual void dump_json(const std::string &outdir) const
virtual void dump_csv(const std::string &outdir) const
virtual void dump_check(std::ostream &os) const

Dump document content to stdout in the special format used for content verification during unit test.

sheet_t get_sheet_index(const pstring &name) const
pstring get_sheet_name(sheet_t sheet_pos) const
size_t sheet_size() const
void set_origin_date(int year, int month, int day)
date_time_t get_origin_date() const
void set_formula_grammar(formula_grammar_t grammar)
formula_grammar_t get_formula_grammar() const
const ixion::formula_name_resolver *get_formula_name_resolver() const
ixion::model_context &get_model_context()
const ixion::model_context &get_model_context() const
const document_config &get_config() const
void set_config(const document_config &cfg)
string_pool &get_string_pool()
void insert_table(table_t *p)

Insert a new table object into the document. The document will take ownership of the inserted object after the call. The object will get inserted only when there is no pre-existing table object of the same name. The object not being inserted will be deleted.

Parameters
  • p: table object to insert.

const table_t *get_table(const pstring &name) const
void finalize()

Sheet

class sheet

This class represents a single sheet instance in the internal document model.

Public Functions

sheet(document &doc, sheet_t sheet_index, row_t row_size, col_t col_size)
virtual ~sheet()
void set_auto(row_t row, col_t col, const char *p, size_t n)
void set_string(row_t row, col_t col, size_t sindex)
void set_value(row_t row, col_t col, double value)
void set_bool(row_t row, col_t col, bool value)
void set_date_time(row_t row, col_t col, int year, int month, int day, int hour, int minute, double second)
void set_format(row_t row, col_t col, size_t index)
void set_format(row_t row_start, col_t col_start, row_t row_end, col_t col_end, size_t index)
void set_formula(row_t row, col_t col, const ixion::formula_tokens_store_ptr_t &tokens)
void set_grouped_formula(const range_t range, ixion::formula_tokens_t tokens)
void set_formula_result(row_t row, col_t col, double value)
void set_formula_result(row_t row, col_t col, const char *p, size_t n)
void set_col_width(col_t col, col_width_t width)
col_width_t get_col_width(col_t col, col_t *col_start, col_t *col_end) const
void set_col_hidden(col_t col, bool hidden)
bool is_col_hidden(col_t col, col_t *col_start, col_t *col_end) const
void set_row_height(row_t row, row_height_t height)
row_height_t get_row_height(row_t row, row_t *row_start, row_t *row_end) const
void set_row_hidden(row_t row, bool hidden)
bool is_row_hidden(row_t row, row_t *row_start, row_t *row_end) const
void set_merge_cell_range(const range_t &range)
range_t get_merge_cell_range(row_t row, col_t col) const

Return the size of a merged cell range.

Return
merged cell range.
Parameters
  • row: row position of the upper-left cell.
  • col: column position of the upper-left cell.

size_t get_string_identifier(row_t row, col_t col) const
auto_filter_t *get_auto_filter_data()
const auto_filter_t *get_auto_filter_data() const
void set_auto_filter_data(auto_filter_t *p)
ixion::abs_range_t get_data_range() const

Return the smallest range that contains all non-empty cells in this sheet. The top-left corner of the returned range is always column 0 and row 0.

Return
smallest range that contains all non-empty cells.

sheet_range get_sheet_range(row_t row_start, col_t col_start, row_t row_end, col_t col_end) const

Return a sheet range object that represents a sub-range within the sheet.

Return
sheet range object.
Parameters
  • row_start: start row position (0-based).
  • col_start: start column position (0-based).
  • row_end: end row position (0-based).
  • col_end: end column position (0-based).

row_t row_size() const
col_t col_size() const
sheet_t get_index() const
date_time_t get_date_time(row_t row, col_t col) const
void finalize()
void dump_flat(std::ostream &os) const
void dump_check(std::ostream &os, const pstring &sheet_name) const
void dump_html(std::ostream &os) const
void dump_json(std::ostream &os) const
void dump_csv(std::ostream &os) const
size_t get_cell_format(row_t row, col_t col) const

Get the cell format ID of specified cell.

Import Factory

class import_factory : public orcus::spreadsheet::iface::import_factory

Public Functions

import_factory(document &doc, row_t row_size = 1048576, col_t col_size = 16384)
import_factory(document &doc, view &view, row_t row_size = 1048576, col_t col_size = 16384)
virtual ~import_factory()
virtual iface::import_global_settings *get_global_settings()
virtual iface::import_shared_strings *get_shared_strings()

Return
pointer to the shared strings instance. It may return NULL if the client app doesn’t support shared strings.

virtual iface::import_styles *get_styles()

Return
pointer to the styles instance. It may return NULL if the client app doesn’t support styles.

virtual iface::import_named_expression *get_named_expression()
virtual iface::import_reference_resolver *get_reference_resolver()
virtual iface::import_pivot_cache_definition *create_pivot_cache_definition(orcus::spreadsheet::pivot_cache_id_t cache_id)

Create an interface for pivot cache definition import for a specified cache ID. In case a pivot cache alrady exists for the passed ID, the client app should overwrite the existing cache with a brand-new cache instance.

Return
pointer to the pivot cache interface instance. If may return NULL if the client app doesn’t support pivot tables.
Parameters
  • cache_id: numeric ID associated with the pivot cache.

virtual iface::import_pivot_cache_records *create_pivot_cache_records(orcus::spreadsheet::pivot_cache_id_t cache_id)

Create an interface for pivot cache records import for a specified cache ID.

Return
pointer to the pivot cache records interface instance. If may return nullptr if the client app doesn’t support pivot tables.
Parameters
  • cache_id: numeric ID associated with the pivot cache.

virtual iface::import_sheet *append_sheet(sheet_t sheet_index, const char *sheet_name, size_t sheet_name_length)

Append a sheet with specified sheet position index and name.

Return
pointer to the sheet instance. It may return nullptr if the client app fails to append a new sheet.
Parameters
  • sheet_index: position index of the sheet to be appended. It is 0-based i.e. the first sheet to be appended will have an index value of 0.
  • sheet_name: pointer to the first character in the buffer where the sheet name is stored.
  • sheet_name_length: length of the sheet name.

virtual iface::import_sheet *get_sheet(const char *sheet_name, size_t sheet_name_length)

Return
pointer to the sheet instance whose name matches the name passed to this method. It returns nullptr if no sheet instance exists by the specified name.

virtual iface::import_sheet *get_sheet(sheet_t sheet_index)

Retrieve sheet instance by specified numerical sheet index.

Return
pointer to the sheet instance, or nullptr if no sheet instance exists at specified sheet index position.
Parameters
  • sheet_index: sheet index

virtual void finalize()

This method is called at the end of import, to give the implementor a chance to perform post-processing if necessary.

void set_default_row_size(row_t row_size)
void set_default_column_size(col_t col_size)
void set_character_set(character_set_t charset)
character_set_t get_character_set() const