#include <import_interface.hpp>
Interface for importing raw string values shared in string cells. String values may be either with or without formatted segments.
To insert an unformatted string, simply use either append() or add() method. The string will then be immediately pushed to the pool.
To insert a string with mixed formatted segments, you need to first use one or more of:
to define the format attribute(s) of a string segment followed by a call to append_segment(). This may be repeated as many times as necessary. Then as the final step, call commit_segments() to insert the entire series of formatted segments to the pool as a single string entry. The following example demonstrates how the code may look like:
iface->set_segment_font_bold(true);
iface->set_segment_font_italic(true);
Definition: import_interface.hpp:72
virtual size_t commit_segments()=0
virtual void set_segment_font_size(double point)=0
virtual void append_segment(std::string_view s)=0
virtual void set_segment_font_name(std::string_view s)=0
◆ add()
virtual size_t orcus::spreadsheet::iface::import_shared_strings::add |
( |
std::string_view |
s | ) |
|
|
pure virtual |
Similar to the append() method, it adds a new string to the string pool; however, this method checks if the string being added is already in the pool before each insertion, to avoid duplicated strings.
- Parameters
-
s | string to add to the pool. |
- Returns
- ID of the inserted string.
◆ append()
virtual size_t orcus::spreadsheet::iface::import_shared_strings::append |
( |
std::string_view |
s | ) |
|
|
pure virtual |
Append a new string to the sequence of strings. Order of insertion determines the numerical ID value of an inserted string. Note that this method assumes that the caller knows the string being appended is not yet in the pool; it does not check on duplicated strings.
- Parameters
-
s | string to append to the pool. |
- Returns
- ID of the inserted string.
◆ append_segment()
virtual void orcus::spreadsheet::iface::import_shared_strings::append_segment |
( |
std::string_view |
s | ) |
|
|
pure virtual |
Push the current string segment to the buffer. Any formatting attributes defined so far will be applied to this segment.
- Parameters
-
s | string value for the segment. |
◆ commit_segments()
virtual size_t orcus::spreadsheet::iface::import_shared_strings::commit_segments |
( |
| ) |
|
|
pure virtual |
Store the entire formatted string in the current buffer to the shared strings pool. The implementor may choose to unconditionally append the string to the pool, or choose to find an existing duplicate and reuse it instead.
- Returns
- ID of the string just inserted, or the ID of an existing string with identical formatting.
◆ set_segment_bold()
virtual void orcus::spreadsheet::iface::import_shared_strings::set_segment_bold |
( |
bool |
b | ) |
|
|
pure virtual |
Set whether or not to make the current segment bold.
- Parameters
-
b | true if it's bold, false otherwise. |
◆ set_segment_font()
virtual void orcus::spreadsheet::iface::import_shared_strings::set_segment_font |
( |
size_t |
font_index | ) |
|
|
pure virtual |
Set the index of a font to apply to the current format attributes. Refer to the import_font_style interface on how to obtain a font index. Note that a single font index is associated with multiple font-related formatting attributes, such as font name, font color, boldness and italics.
- Parameters
-
font_index | positive integer representing the font to use. |
◆ set_segment_font_color()
virtual void orcus::spreadsheet::iface::import_shared_strings::set_segment_font_color |
( |
color_elem_t |
alpha, |
|
|
color_elem_t |
red, |
|
|
color_elem_t |
green, |
|
|
color_elem_t |
blue |
|
) |
| |
|
pure virtual |
Set the color of a font in ARGB format to the current segment.
- Parameters
-
alpha | alpha component value (0-255). |
red | red component value (0-255). |
green | green component value (0-255). |
blue | blue component value (0-255). |
◆ set_segment_font_name()
virtual void orcus::spreadsheet::iface::import_shared_strings::set_segment_font_name |
( |
std::string_view |
s | ) |
|
|
pure virtual |
Set the name of a font to the current segment.
- Parameters
-
◆ set_segment_font_size()
virtual void orcus::spreadsheet::iface::import_shared_strings::set_segment_font_size |
( |
double |
point | ) |
|
|
pure virtual |
Set a font size to the current segment.
- Parameters
-
point | font size in points. |
◆ set_segment_italic()
virtual void orcus::spreadsheet::iface::import_shared_strings::set_segment_italic |
( |
bool |
b | ) |
|
|
pure virtual |
Set whether or not to make the current segment italic.
- Parameters
-
b | true if it's italic, false otherwise. |