mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
reformat cell.cpp
This commit is contained in:
parent
dab1b0218d
commit
d393343c2e
|
@ -21,6 +21,7 @@
|
||||||
//
|
//
|
||||||
// @license: http://www.opensource.org/licenses/mit-license.php
|
// @license: http://www.opensource.org/licenses/mit-license.php
|
||||||
// @author: see AUTHORS file
|
// @author: see AUTHORS file
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -43,9 +44,9 @@
|
||||||
#include <xlnt/styles/style.hpp>
|
#include <xlnt/styles/style.hpp>
|
||||||
#include <xlnt/utils/date.hpp>
|
#include <xlnt/utils/date.hpp>
|
||||||
#include <xlnt/utils/datetime.hpp>
|
#include <xlnt/utils/datetime.hpp>
|
||||||
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
#include <xlnt/utils/time.hpp>
|
#include <xlnt/utils/time.hpp>
|
||||||
#include <xlnt/utils/timedelta.hpp>
|
#include <xlnt/utils/timedelta.hpp>
|
||||||
#include <xlnt/utils/exceptions.hpp>
|
|
||||||
#include <xlnt/workbook/workbook.hpp>
|
#include <xlnt/workbook/workbook.hpp>
|
||||||
#include <xlnt/worksheet/column_properties.hpp>
|
#include <xlnt/worksheet/column_properties.hpp>
|
||||||
#include <xlnt/worksheet/row_properties.hpp>
|
#include <xlnt/worksheet/row_properties.hpp>
|
||||||
|
@ -147,8 +148,8 @@ namespace xlnt {
|
||||||
|
|
||||||
const std::unordered_map<std::string, int> &cell::error_codes()
|
const std::unordered_map<std::string, int> &cell::error_codes()
|
||||||
{
|
{
|
||||||
static const std::unordered_map<std::string, int> *codes =
|
static const auto *codes = new std::unordered_map<std::string, int>
|
||||||
new std::unordered_map<std::string, int>({
|
{
|
||||||
{"#NULL!", 0},
|
{"#NULL!", 0},
|
||||||
{"#DIV/0!", 1},
|
{"#DIV/0!", 1},
|
||||||
{"#VALUE!", 2},
|
{"#VALUE!", 2},
|
||||||
|
@ -156,7 +157,7 @@ const std::unordered_map<std::string, int> &cell::error_codes()
|
||||||
{"#NAME?", 4},
|
{"#NAME?", 4},
|
||||||
{"#NUM!", 5},
|
{"#NUM!", 5},
|
||||||
{"#N/A!", 6}
|
{"#N/A!", 6}
|
||||||
});
|
};
|
||||||
|
|
||||||
return *codes;
|
return *codes;
|
||||||
}
|
}
|
||||||
|
@ -427,9 +428,7 @@ bool cell::is_merged() const
|
||||||
|
|
||||||
bool cell::is_date() const
|
bool cell::is_date() const
|
||||||
{
|
{
|
||||||
return get_data_type() == type::numeric
|
return get_data_type() == type::numeric && has_format() && get_number_format().is_date_format();
|
||||||
&& has_format()
|
|
||||||
&& get_number_format().is_date_format();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cell_reference cell::get_reference() const
|
cell_reference cell::get_reference() const
|
||||||
|
@ -562,10 +561,8 @@ std::pair<int, int> cell::get_anchor() const
|
||||||
static const auto DefaultColumnWidth = 51.85L;
|
static const auto DefaultColumnWidth = 51.85L;
|
||||||
static const auto DefaultRowHeight = 15.0L;
|
static const auto DefaultRowHeight = 15.0L;
|
||||||
|
|
||||||
auto points_to_pixels = [](long double value, long double dpi)
|
auto points_to_pixels = [](
|
||||||
{
|
long double value, long double dpi) { return static_cast<int>(std::ceil(value * dpi / 72)); };
|
||||||
return static_cast<int>(std::ceil(value * dpi / 72));
|
|
||||||
};
|
|
||||||
|
|
||||||
auto left_columns = d_->column_ - 1;
|
auto left_columns = d_->column_ - 1;
|
||||||
int left_anchor = 0;
|
int left_anchor = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user