Skip to content

Integer value can't be read as double #196

@SpareSimian

Description

@SpareSimian

I have a cell with 5000 in it and I'm reading it into a double when I get a bad variant exception from std::get(5000). Fix seems to be to change the stanza in XLCellValue.cpp at line 244 to look like this (add the Integer line):

                if constexpr (std::is_floating_point_v<T>) {
                    if (m_type == XLValueType::Error) return std::nan("1");
                    if (m_type == XLValueType::Integer) return static_cast<T>(std::get<int64_t>(m_value));
                    return static_cast<T>(std::get<double>(m_value));
                }

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolvedThis issue has been resolved.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions