Merge branch 'TataMata-master' into dev

This commit is contained in:
Thomas Fussell 2017-12-08 15:13:49 -05:00
commit 842eedae8c
2 changed files with 32 additions and 3 deletions

View File

@ -1704,6 +1704,26 @@ void xlsx_consumer::read_shared_workbook_user_data()
{
}
namespace {
/// <summary>
/// Try to find given xfid value in the styles vector and, if succeeded, set's the optional style.
/// </summary>
void set_style_by_xfid(
const std::vector<std::pair<style_impl, std::size_t>>& styles, std::size_t xfid, optional<std::string>& style
)
{
for(auto item : styles)
{
if( item.second == xfid )
{
style = item.first.name;
}
}
}
} // namespace
void xlsx_consumer::read_stylesheet()
{
target_.impl().stylesheet_ = detail::stylesheet();
@ -2326,7 +2346,7 @@ void xlsx_consumer::read_stylesheet()
new_format.pivot_button_ = record.first.pivot_button_;
new_format.quote_prefix_ = record.first.quote_prefix_;
new_format.style = styles.at(record.second).first.name;
set_style_by_xfid(styles, record.second, new_format.style);
}
}

View File

@ -161,4 +161,13 @@ cell cell_vector::operator[](std::size_t cell_index)
return ws_.cell(cursor_.make_offset(0, static_cast<int>(cell_index)));
}
const cell cell_vector::operator[](std::size_t cell_index) const
{
if (order_ == major_order::row)
{
return ws_.cell(cursor_.make_offset(static_cast<int>(cell_index), 0));
}
return ws_.cell(cursor_.make_offset(0, static_cast<int>(cell_index)));
}
} // namespace xlnt