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

xlnt-community / xlnt / 39e5966a-5261-4e10-9180-d7fddc7140a7

28 Jan 2026 09:10PM UTC coverage: 83.928% (+1.1%) from 82.793%
39e5966a-5261-4e10-9180-d7fddc7140a7

Pull #87

circleci

doomlaur
Better explain how string encodings work in README.md
Pull Request #87: Improve documentation when exceptions are thrown (fixes #81)

15263 of 19954 branches covered (76.49%)

722 of 901 new or added lines in 37 files covered. (80.13%)

15 existing lines in 5 files now uncovered.

12491 of 14883 relevant lines covered (83.93%)

12216.5 hits per line

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

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

25
#include <limits>
26

27
#include <xlnt/xlnt_config.hpp>
28
#include <xlnt/utils/exceptions.hpp>
29
#include <detail/constants.hpp>
30

31
namespace xlnt {
32

33
row_t constants::min_row()
350✔
34
{
35
    return 1;
350✔
36
}
37

38
row_t constants::max_row()
13,472✔
39
{
40
    return std::numeric_limits<row_t>::max();
13,472✔
41
}
42

43
row_t constants::max_row_reference_default()
3✔
44
{
45
    // According to the OOXML specification:
46
    // "In SpreadsheetML, cell references range from column A1–A1048576 (column A:A) to column XFD1–XFD1048576 (column XFD:XFD).
47
    // An implementation can extend this range."
48
    return 1048576;
3✔
49
}
50

51
const column_t constants::min_column()
1,997✔
52
{
53
    return column_t(1);
1,997✔
54
}
55

56
const column_t constants::max_column()
15,146✔
57
{
58
    return column_t(std::numeric_limits<column_t::index_t>::max());
15,146✔
59
}
60

61
const column_t constants::max_column_reference_default()
4✔
62
{
63
    // According to the OOXML specification:
64
    // "In SpreadsheetML, cell references range from column A1–A1048576 (column A:A) to column XFD1–XFD1048576 (column XFD:XFD).
65
    // An implementation can extend this range."
66
    return column_t(16384); // column XFD
4✔
67
}
68

69
size_t constants::max_elements_for_reserve()
541✔
70
{
71
    return 10000;
541✔
72
}
73

74
const std::string &constants::empty_str()
10✔
75
{
76
    static const std::string empty;
10!
77
    return empty;
10✔
78
}
79

80
// constants
81
const path constants::package_properties()
×
82
{
83
    return path("docProps");
×
84
}
85

86
const path constants::package_xl()
7✔
87
{
88
    return path("/xl");
14✔
89
}
90

91
const path constants::package_root_rels()
×
92
{
93
    return path(std::string("_rels"));
×
94
}
95

96
const path constants::package_theme()
×
97
{
98
    return package_xl().append("theme");
×
99
}
100

101
const path constants::package_worksheets()
×
102
{
103
    return package_xl().append("worksheets");
×
104
}
105

106
const path constants::package_drawings()
×
107
{
108
    return package_xl().append("drawings");
×
109
}
110

111
const path constants::part_content_types()
×
112
{
113
    return path("[Content_Types].xml");
×
114
}
115

116
const path constants::part_root_relationships()
×
117
{
118
    return package_root_rels().append(".rels");
×
119
}
120

121
const path constants::part_core()
×
122
{
123
    return package_properties().append("core.xml");
×
124
}
125

126
const path constants::part_app()
×
127
{
128
    return package_properties().append("app.xml");
×
129
}
130

131
const path constants::part_workbook()
×
132
{
133
    return package_xl().append("workbook.xml");
×
134
}
135

136
const path constants::part_styles()
×
137
{
138
    return package_xl().append("styles.xml");
×
139
}
140

141
const path constants::part_theme()
×
142
{
143
    return package_theme().append("theme1.xml");
×
144
}
145

146
const path constants::part_shared_strings()
×
147
{
148
    return package_xl().append("sharedStrings.xml");
×
149
}
150

151
const std::unordered_map<std::string, std::string> &constants::namespaces()
4,952✔
152
{
153
    static const std::unordered_map<std::string, std::string> namespaces =
154
        std::unordered_map<std::string, std::string>{
155
            {"spreadsheetml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"},
156
            {"content-types", "http://schemas.openxmlformats.org/package/2006/content-types"},
157
            {"relationships", "http://schemas.openxmlformats.org/package/2006/relationships"},
158
            {"drawingml", "http://schemas.openxmlformats.org/drawingml/2006/main"},
159
            {"workbook", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"},
160
            {"core-properties", "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"},
161
            {"extended-properties", "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"},
162
            {"custom-properties", "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"},
163

164
            {"encryption", "http://schemas.microsoft.com/office/2006/encryption"},
165
            {"encryption-password", "http://schemas.microsoft.com/office/2006/keyEncryptor/password"},
166
            {"encryption-certificate", "http://schemas.microsoft.com/office/2006/keyEncryptor/certificate"},
167

168
            {"dc", "http://purl.org/dc/elements/1.1/"},
169
            {"dcterms", "http://purl.org/dc/terms/"},
170
            {"dcmitype", "http://purl.org/dc/dcmitype/"},
171
            {"mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"},
172
            {"mx", "http://schemas.microsoft.com/office/mac/excel/2008/main"},
173
            {"r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"},
174
            {"thm15", "http://schemas.microsoft.com/office/thememl/2012/main"},
175
            {"vt", "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"},
176
            {"x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"},
177
            {"x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"},
178
            {"x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"},
179
            {"x15ac", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"},
180
            {"xml", "http://www.w3.org/XML/1998/namespace"},
181
            {"xsi", "http://www.w3.org/2001/XMLSchema-instance"},
182

183
            {"a", "http://schemas.openxmlformats.org/drawingml/2006/main"},
184
            {"xdr", "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"},
185

186
            {"loext", "http://schemas.libreoffice.org/"}};
4,982!
187

188
    return namespaces;
4,952✔
189
}
1!
190

191
const std::string &constants::ns(const std::string &id)
2,476✔
192
{
193
    auto match = namespaces().find(id);
2,476✔
194

195
    if (match == namespaces().end())
2,476!
196
    {
NEW
197
        throw xlnt::invalid_parameter("bad namespace \"" + id + "\"");
×
198
    }
199

200
    return match->second;
4,952✔
201
}
202

203
} // 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