Spreadsheet Import Filters¶
Plain Text (CSV)¶
-
class
orcus_csv
: public orcus::iface::import_filter¶ Public Functions
-
orcus_csv
()¶
-
orcus_csv
(spreadsheet::iface::import_factory *factory)¶
-
~orcus_csv
()¶
-
virtual void
read_file
(const std::string &filepath)¶ expects a system path to a local file
-
virtual void
read_stream
(std::string_view stream)¶ expects the whole content of the file
-
virtual std::string_view
get_name
() const¶
-
Open Document Spreadsheet¶
-
class
orcus_ods
: public orcus::iface::import_filter¶ Public Functions
-
orcus_ods
(spreadsheet::iface::import_factory *factory)¶
-
~orcus_ods
()¶
-
virtual void
read_file
(const std::string &filepath)¶ expects a system path to a local file
-
virtual void
read_stream
(std::string_view stream)¶ expects the whole content of the file
-
virtual std::string_view
get_name
() const¶
Public Static Functions
-
static bool
detect
(const unsigned char *blob, size_t size)¶
-
-
class
import_ods
¶ Public Functions
-
import_ods
()¶
-
import_ods
(const import_ods&)¶
-
import_ods &
operator=
(const import_ods&)¶
Public Static Functions
-
static void
read_styles
(std::string_view s, spreadsheet::iface::import_styles *data)¶
-
Microsoft Excel 2003 XML¶
-
class
orcus_xls_xml
: public orcus::iface::import_filter¶ Public Functions
-
orcus_xls_xml
(spreadsheet::iface::import_factory *factory)¶
-
~orcus_xls_xml
()¶
-
orcus_xls_xml
(const orcus_xls_xml&)¶
-
orcus_xls_xml &
operator=
(const orcus_xls_xml&)¶
-
virtual void
read_file
(const std::string &filepath)¶ expects a system path to a local file
-
virtual void
read_stream
(std::string_view stream)¶ expects the whole content of the file
-
virtual std::string_view
get_name
() const¶
Public Static Functions
-
static bool
detect
(const unsigned char *blob, size_t size)¶
-
Microsoft Excel 2007 XML¶
-
class
orcus_xlsx
: public orcus::iface::import_filter¶ Public Functions
-
orcus_xlsx
(spreadsheet::iface::import_factory *factory)¶
-
~orcus_xlsx
()¶
-
orcus_xlsx
(const orcus_xlsx&)¶
-
orcus_xlsx &
operator=
(const orcus_xlsx&)¶
-
virtual void
read_file
(const std::string &filepath)¶ expects a system path to a local file
-
virtual void
read_stream
(std::string_view stream)¶ expects the whole content of the file
-
virtual std::string_view
get_name
() const¶
Public Static Functions
-
static bool
detect
(const unsigned char *blob, size_t size)¶
-
-
class
import_xlsx
¶ Public Functions
-
import_xlsx
()¶
-
import_xlsx
(const import_xlsx&)¶
-
import_xlsx &
operator=
(const import_xlsx&)¶
Public Static Functions
-
static void
read_table
(std::string_view s, spreadsheet::iface::import_table &table, spreadsheet::iface::import_reference_resolver &resolver)¶
-
Gnumeric XML¶
-
class
orcus_gnumeric
: public orcus::iface::import_filter¶ Public Functions
-
orcus_gnumeric
()¶
-
orcus_gnumeric
(const orcus_gnumeric&)¶
-
orcus_gnumeric &
operator=
(const orcus_gnumeric&)¶
-
orcus_gnumeric
(spreadsheet::iface::import_factory *factory)¶
-
~orcus_gnumeric
()¶
-
virtual void
read_file
(const std::string &filepath)¶ expects a system path to a local file
-
virtual void
read_stream
(std::string_view stream)¶ expects the whole content of the file
-
virtual std::string_view
get_name
() const¶
Public Static Functions
-
static bool
detect
(const unsigned char *blob, size_t size)¶
-
Generic XML¶
-
class
orcus_xml
¶ Public Functions
-
orcus_xml
(xmlns_repository &ns_repo, spreadsheet::iface::import_factory *im_fact, spreadsheet::iface::export_factory *ex_fact)¶
-
~orcus_xml
()¶
-
void
set_namespace_alias
(std::string_view alias, std::string_view uri, bool default_ns = false)¶ Define a namespace and its alias used in a map file.
- Parameters
alias
: alias for the namespace.uri
: namespace value.default_ns
: whether or not to use this namespace as the default namespace. When this value is set to true, the namespace being set will be applied for all elements and attributes used in the paths without explicit namespace values.
-
void
set_cell_link
(std::string_view xpath, std::string_view sheet, spreadsheet::row_t row, spreadsheet::col_t col)¶ Define a mapping of a single element or attribute to a single cell location.
- Parameters
xpath
: path to the element or attribute to link.sheet
: sheet index (0-based) of the linked cell location.row
: row index (0-based) of the linked cell location.col
: column index (0-based) of the linked cell location.
-
void
start_range
(std::string_view sheet, spreadsheet::row_t row, spreadsheet::col_t col)¶ Initiate the mapping definition of a linked range. The definition will get committed when the commit_range method is called.
- Parameters
sheet
: sheet index (0-based) of the linked cell location.row
: row index (0-based) of the linked cell location.col
: column index (0-based) of the linked cell location.
-
void
append_field_link
(std::string_view xpath, std::string_view label)¶ Append a field that is mapped to a specified path in the XML document to the current linked range.
- Parameters
xpath
: path to the element or attribute to link as a field.label
: custom header label to use in lieu of the name of the linked entity.
-
void
set_range_row_group
(std::string_view xpath)¶ Set the element located in the specified path as a row group in the current linked range.
If the element is defined as a row-group element, the row index will increment whenever that element closes.
- Parameters
xpath
: path to the element to use as a row group element.
-
void
commit_range
()¶ Commit the mapping definition of the current range.
-
void
append_sheet
(std::string_view name)¶ Append a new sheet to the spreadsheet document.
- Parameters
name
: name of the sheet.
-
void
read_stream
(std::string_view stream)¶ Read the stream containing the source XML document.
- Parameters
stream
: stream containing the content of the source XML document.
-
void
read_map_definition
(std::string_view stream)¶ Read an XML stream that contains an entire set of mapping rules.
This method also inserts all necessary sheets into the document model.
- Parameters
stream
: stream containing the XML string.
-
void
detect_map_definition
(std::string_view stream)¶ Read a stream containing the source XML document, automatically detect all linkable ranges and import them one range per sheet.
- Parameters
stream
: stream containing the source XML document.
-
void
write_map_definition
(std::string_view stream, std::ostream &out) const¶ Read a stream containing the source XML document, automatically detect all linkable ranges, and write a map definition file depicting the detected ranges.
- Parameters
stream
: stream containing the source XML document.out
: output stream to write the map definition file to.
-
void
write
(std::string_view stream, std::ostream &out) const¶ Write the linked cells and ranges in the spreadsheet document as an XML document using the same map definition rules used to load the content.
Note that this requires the source XML document stream, as it re-uses parts of the source stream.
- Parameters
stream
: stream containing the source XML document.out
: output stream to write the XML document to.
-