• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

xlnt-community / xlnt / 796b5d63-faf9-48e9-946d-5f649cf3d172

05 Mar 2025 05:11AM UTC coverage: 82.27% (+0.4%) from 81.87%
796b5d63-faf9-48e9-946d-5f649cf3d172

push

circleci

web-flow
Fix workbook comparisons, cleanup of included headers (#59)

This PR does the following:
1. Fixes issue https://github.com/xlnt-community/xlnt/issues/58. Please
read the issue for detailed infos.
2. Changes / removes a few definitions of `XLNT_API(_INTERNAL)` which
were defined in the wrong places (e.g. `.cpp` file, or in the header
although the function was implemented in the header too).
3. Cleans up many unnecessary or missing headers which I found along the
way.
4. Added `operator!=` to many classes to ease such comparisons and
improve programming experience.

103 of 143 new or added lines in 20 files covered. (72.03%)

3 existing lines in 2 files now uncovered.

11554 of 14044 relevant lines covered (82.27%)

1176465.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.0
./source/worksheet/page_margins.cpp
1
// Copyright (c) 2014-2022 Thomas Fussell
2
// Copyright (c) 2010-2015 openpyxl
3
// Copyright (c) 2024-2025 xlnt-community
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included in
13
// all copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
// THE SOFTWARE
22
//
23
// @license: http://www.opensource.org/licenses/mit-license.php
24
// @author: see AUTHORS file
25
#include <xlnt/utils/numeric.hpp>
26
#include <xlnt/worksheet/page_margins.hpp>
27

28
namespace xlnt {
29

30
page_margins::page_margins()
401✔
31
{
32
}
401✔
33

34
double page_margins::top() const
91✔
35
{
36
    return top_;
91✔
37
}
38

39
void page_margins::top(double top)
402✔
40
{
41
    top_ = top;
402✔
42
}
402✔
43

44
double page_margins::left() const
91✔
45
{
46
    return left_;
91✔
47
}
48

49
void page_margins::left(double left)
402✔
50
{
51
    left_ = left;
402✔
52
}
402✔
53

54
double page_margins::bottom() const
91✔
55
{
56
    return bottom_;
91✔
57
}
58

59
void page_margins::bottom(double bottom)
402✔
60
{
61
    bottom_ = bottom;
402✔
62
}
402✔
63

64
double page_margins::right() const
91✔
65
{
66
    return right_;
91✔
67
}
68

69
void page_margins::right(double right)
402✔
70
{
71
    right_ = right;
402✔
72
}
402✔
73

74
double page_margins::header() const
91✔
75
{
76
    return header_;
91✔
77
}
78

79
void page_margins::header(double header)
402✔
80
{
81
    header_ = header;
402✔
82
}
402✔
83

84
double page_margins::footer() const
91✔
85
{
86
    return footer_;
91✔
87
}
88

89
void page_margins::footer(double footer)
402✔
90
{
91
    footer_ = footer;
402✔
92
}
402✔
93

94
bool page_margins::operator==(const page_margins &rhs) const
8✔
95
{
96
    return detail::float_equals(top_, rhs.top_)
8✔
97
        && detail::float_equals(left_, rhs.left_)
8✔
98
        && detail::float_equals(right_, rhs.right_)
8✔
99
        && detail::float_equals(header_, rhs.header_)
8✔
100
        && detail::float_equals(footer_, rhs.footer_);
16✔
101
}
102

NEW
103
bool page_margins::operator!=(const page_margins &rhs) const
×
104
{
NEW
105
    return !(*this == rhs);
×
106
}
107

108
} // namespace xlnt
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc