void test_write_height() { auto ws = wb_.create_sheet(); ws.get_cell("F1").set_value(10); ws.get_row_properties(ws.get_cell("F1").get_row()).set_height(30); auto content = xlnt::writer::write_worksheet(ws, {}, {}); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_height.xml", content)); }
cell_reference worksheet::get_point_pos(int left, int top) const { static const double DefaultColumnWidth = 51.85; static const double DefaultRowHeight = 15.0; auto points_to_pixels = [](long double value, long double dpi) { return static_cast<int>(std::ceil(value * dpi / 72)); }; auto default_height = points_to_pixels(DefaultRowHeight, 96.0); auto default_width = points_to_pixels(DefaultColumnWidth, 96.0); column_t current_column = 1; row_t current_row = 1; int left_pos = 0; int top_pos = 0; while (left_pos <= left) { current_column++; if (has_column_properties(current_column)) { auto cdw = get_column_properties(current_column).width; if (cdw >= 0) { left_pos += points_to_pixels(cdw, 96.0); continue; } } left_pos += default_width; } while (top_pos <= top) { current_row++; if (has_row_properties(current_row)) { auto cdh = get_row_properties(current_row).height; if (cdh >= 0) { top_pos += points_to_pixels(cdh, 96.0); continue; } } top_pos += default_height; } return { current_column - 1, current_row - 1 }; }