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

xlnt-community / xlnt / 517feceb-4295-453c-8388-d9aaa9a5eda5

20 Apr 2025 10:10PM UTC coverage: 82.133% (-0.1%) from 82.27%
517feceb-4295-453c-8388-d9aaa9a5eda5

Pull #74

circleci

m7913d
Publishing coverage to github pages
Pull Request #74: Publishing coverage to github pages

14076 of 18604 branches covered (75.66%)

1 of 5 new or added lines in 1 file covered. (20.0%)

16 existing lines in 4 files now uncovered.

11538 of 14048 relevant lines covered (82.13%)

11772.37 hits per line

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

58.03
./source/detail/serialization/custom_value_traits.cpp
1
// Copyright (c) 2016-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 <detail/serialization/custom_value_traits.hpp>
26

27
namespace xlnt {
28
namespace detail {
29

30
/// <summary>
31
/// Returns the string representation of the underline style.
32
/// </summary>
33
std::string to_string(font::underline_style style)
20✔
34
{
35
    switch (style)
20!
36
    {
37
    case font::underline_style::double_:
4✔
38
        return "double";
8✔
39
    case font::underline_style::double_accounting:
12✔
40
        return "doubleAccounting";
24✔
41
    case font::underline_style::single:
×
42
        return "single";
×
43
    case font::underline_style::single_accounting:
4✔
44
        return "singleAccounting";
8✔
45
    case font::underline_style::none:
×
46
        return "none";
×
47
    }
48

49
    default_case("single");
×
50
}
51

52
/// <summary>
53
/// Returns the string representation of the relationship type.
54
/// </summary>
55
std::string to_string(relationship_type t)
392✔
56
{
57
    switch (t)
392!
58
    {
59
    case relationship_type::office_document:
47✔
60
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";
94✔
61
    case relationship_type::thumbnail:
32✔
62
        return "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
64✔
63
    case relationship_type::calculation_chain:
6✔
64
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain";
12✔
65
    case relationship_type::extended_properties:
44✔
66
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";
88✔
67
    case relationship_type::core_properties:
44✔
68
        return "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
88✔
69
    case relationship_type::worksheet:
56✔
70
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
112✔
71
    case relationship_type::shared_string_table:
33✔
72
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings";
66✔
73
    case relationship_type::stylesheet:
45✔
74
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles";
90✔
75
    case relationship_type::theme:
44✔
76
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
88✔
77
    case relationship_type::hyperlink:
16✔
78
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
32✔
79
    case relationship_type::chartsheet:
×
80
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet";
×
81
    case relationship_type::comments:
8✔
82
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments";
16✔
83
    case relationship_type::vml_drawing:
8✔
84
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing";
16✔
85
    case relationship_type::custom_properties:
3✔
86
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties";
6✔
87
    case relationship_type::printer_settings:
1✔
88
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings";
2✔
89
    case relationship_type::connections:
×
90
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections";
×
91
    case relationship_type::custom_property:
×
92
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customProperty";
×
93
    case relationship_type::custom_xml_mappings:
×
94
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlMappings";
×
95
    case relationship_type::dialogsheet:
×
96
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet";
×
97
    case relationship_type::drawings:
2✔
98
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing";
4✔
99
    case relationship_type::external_workbook_references:
×
100
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath";
×
101
    case relationship_type::pivot_table:
×
102
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable";
×
103
    case relationship_type::pivot_table_cache_definition:
×
104
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition";
×
105
    case relationship_type::pivot_table_cache_records:
×
106
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords";
×
107
    case relationship_type::query_table:
×
108
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/queryTable";
×
109
    case relationship_type::shared_workbook_revision_headers:
×
110
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionHeaders";
×
111
    case relationship_type::shared_workbook:
×
112
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedWorkbook";
×
113
    case relationship_type::revision_log:
×
114
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionLog";
×
115
    case relationship_type::shared_workbook_user_data:
×
116
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/usernames";
×
117
    case relationship_type::single_cell_table_definitions:
×
118
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableSingleCells";
×
119
    case relationship_type::table_definition:
×
120
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table";
×
121
    case relationship_type::volatile_dependencies:
×
122
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/volatileDependencies";
×
123
    case relationship_type::vbaproject:
1✔
124
        return "http://schemas.microsoft.com/office/2006/relationships/vbaProject";
2✔
125
    case relationship_type::image:
2✔
126
        return "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
4✔
127
    case relationship_type::unknown:
×
128
        return "unknown";
×
129
    }
130

131
    default_case("unknown");
×
132
}
133

134
std::string to_string(pattern_fill_type fill_type)
227✔
135
{
136
    switch (fill_type)
227!
137
    {
138
    case pattern_fill_type::darkdown:
×
139
        return "darkdown";
×
140
    case pattern_fill_type::darkgray:
×
141
        return "darkgray";
×
142
    case pattern_fill_type::darkgrid:
×
143
        return "darkgrid";
×
144
    case pattern_fill_type::darkhorizontal:
×
145
        return "darkhorizontal";
×
146
    case pattern_fill_type::darktrellis:
×
147
        return "darkhorizontal";
×
148
    case pattern_fill_type::darkup:
×
149
        return "darkup";
×
150
    case pattern_fill_type::darkvertical:
×
151
        return "darkvertical";
×
152
    case pattern_fill_type::gray0625:
×
153
        return "gray0625";
×
154
    case pattern_fill_type::gray125:
44✔
155
        return "gray125";
88✔
156
    case pattern_fill_type::lightdown:
×
157
        return "lightdown";
×
158
    case pattern_fill_type::lightgray:
1✔
159
        return "lightgray";
2✔
160
    case pattern_fill_type::lightgrid:
×
161
        return "lightgrid";
×
162
    case pattern_fill_type::lighthorizontal:
×
163
        return "lighthorizontal";
×
164
    case pattern_fill_type::lighttrellis:
×
165
        return "lighttrellis";
×
166
    case pattern_fill_type::lightup:
×
167
        return "lightup";
×
168
    case pattern_fill_type::lightvertical:
×
169
        return "lightvertical";
×
170
    case pattern_fill_type::mediumgray:
×
171
        return "mediumgray";
×
172
    case pattern_fill_type::solid:
137✔
173
        return "solid";
274✔
174
    case pattern_fill_type::none:
45✔
175
        return "none";
90✔
176
    }
177

178
    default_case("none");
×
179
}
180

181
std::string to_string(gradient_fill_type fill_type)
×
182
{
183
    switch (fill_type)
×
184
    {
185
    case gradient_fill_type::linear:
×
186
        return "linear";
×
187
    case gradient_fill_type::path:
×
188
        return "path";
×
189
    }
190

191
    default_case("linear");
×
192
}
193

194
std::string to_string(border_style style)
116✔
195
{
196
    switch (style)
116!
197
    {
198
    case border_style::dashdot:
×
199
        return "dashDot";
×
200
    case border_style::dashdotdot:
×
201
        return "dashDotDot";
×
202
    case border_style::dashed:
×
203
        return "dashed";
×
204
    case border_style::dotted:
×
205
        return "dotted";
×
206
    case border_style::double_:
24✔
207
        return "double";
48✔
208
    case border_style::hair:
×
209
        return "hair";
×
210
    case border_style::medium:
4✔
211
        return "medium";
8✔
212
    case border_style::mediumdashdot:
×
213
        return "mediumDashDot";
×
214
    case border_style::mediumdashdotdot:
×
215
        return "mediumDashDotDot";
×
216
    case border_style::mediumdashed:
×
217
        return "mediumDashed";
×
218
    case border_style::slantdashdot:
×
219
        return "slantDashDot";
×
220
    case border_style::thick:
8✔
221
        return "thick";
16✔
222
    case border_style::thin:
80✔
223
        return "thin";
160✔
224
    case border_style::none:
×
225
        return "none";
×
226
    }
227

228
    default_case("none");
×
229
}
230

231
std::string to_string(vertical_alignment alignment)
74✔
232
{
233
    switch (alignment)
74!
234
    {
235
    case vertical_alignment::top:
15✔
236
        return "top";
30✔
237
    case vertical_alignment::center:
52✔
238
        return "center";
104✔
239
    case vertical_alignment::bottom:
3✔
240
        return "bottom";
6✔
UNCOV
241
    case vertical_alignment::justify:
×
UNCOV
242
        return "justify";
×
243
    case vertical_alignment::distributed:
4✔
244
        return "distributed";
8✔
245
    }
246

247
    default_case("top");
×
248
}
249

250
std::string to_string(horizontal_alignment alignment)
24✔
251
{
252
    switch (alignment)
24!
253
    {
254
    case horizontal_alignment::general:
2✔
255
        return "general";
4✔
256
    case horizontal_alignment::left:
13✔
257
        return "left";
26✔
258
    case horizontal_alignment::center:
5✔
259
        return "center";
10✔
260
    case horizontal_alignment::right:
4✔
261
        return "right";
8✔
262
    case horizontal_alignment::fill:
×
263
        return "fill";
×
UNCOV
264
    case horizontal_alignment::justify:
×
UNCOV
265
        return "justify";
×
UNCOV
266
    case horizontal_alignment::center_continuous:
×
UNCOV
267
        return "centerContinuous";
×
268
    case horizontal_alignment::distributed:
×
269
        return "distributed";
×
270
    }
271

272
    default_case("general");
×
273
}
274

275
std::string to_string(border_side side)
435✔
276
{
277
    switch (side)
435!
278
    {
279
    case border_side::bottom:
87✔
280
        return "bottom";
174✔
281
    case border_side::top:
87✔
282
        return "top";
174✔
283
    case border_side::start:
87✔
284
        return "left";
174✔
285
    case border_side::end:
87✔
286
        return "right";
174✔
287
    case border_side::horizontal:
×
288
        return "horizontal";
×
289
    case border_side::vertical:
×
290
        return "vertical";
×
291
    case border_side::diagonal:
87✔
292
        return "diagonal";
174✔
293
    }
294

295
    default_case("top");
×
296
}
297

298
std::string to_string(core_property prop)
202✔
299
{
300
    switch (prop)
202!
301
    {
302
    case core_property::category:
5✔
303
        return "category";
10✔
304
    case core_property::content_status:
1✔
305
        return "contentStatus";
2✔
306
    case core_property::created:
39✔
307
        return "created";
78✔
308
    case core_property::creator:
41✔
309
        return "creator";
82✔
310
    case core_property::description:
6✔
311
        return "description";
12✔
312
    case core_property::identifier:
1✔
313
        return "identifier";
2✔
314
    case core_property::keywords:
5✔
315
        return "keywords";
10✔
316
    case core_property::language:
2✔
317
        return "language";
4✔
318
    case core_property::last_modified_by:
43✔
319
        return "lastModifiedBy";
86✔
320
    case core_property::last_printed:
1✔
321
        return "lastPrinted";
2✔
322
    case core_property::modified:
43✔
323
        return "modified";
86✔
324
    case core_property::revision:
2✔
325
        return "revision";
4✔
326
    case core_property::subject:
6✔
327
        return "subject";
12✔
328
    case core_property::title:
6✔
329
        return "title";
12✔
330
    case core_property::version:
1✔
331
        return "version";
2✔
332
    }
333

334
    default_case("category");
×
335
}
336

337
std::string to_string(extended_property prop)
445✔
338
{
339
    switch (prop)
445!
340
    {
341
    case extended_property::application:
43✔
342
        return "Application";
86✔
343
    case extended_property::app_version:
42✔
344
        return "AppVersion";
84✔
345
    case extended_property::characters:
1✔
346
        return "Characters";
2✔
347
    case extended_property::characters_with_spaces:
1✔
348
        return "CharactersWithSpaces";
2✔
349
    case extended_property::company:
39✔
350
        return "Company";
78✔
351
    case extended_property::dig_sig:
1✔
352
        return "DigSig";
2✔
353
    case extended_property::doc_security:
42✔
354
        return "DocSecurity";
84✔
355
    case extended_property::heading_pairs:
42✔
356
        return "HeadingPairs";
84✔
357
    case extended_property::hidden_slides:
1✔
358
        return "HiddenSlides";
2✔
359
    case extended_property::hyperlinks_changed:
42✔
360
        return "HyperlinksChanged";
84✔
361
    case extended_property::hyperlink_base:
5✔
362
        return "HyperlinkBase";
10✔
363
    case extended_property::h_links:
1✔
364
        return "HLinks";
2✔
365
    case extended_property::lines:
1✔
366
        return "Lines";
2✔
367
    case extended_property::links_up_to_date:
42✔
368
        return "LinksUpToDate";
84✔
369
    case extended_property::manager:
5✔
370
        return "Manager";
10✔
371
    case extended_property::m_m_clips:
1✔
372
        return "MMClips";
2✔
373
    case extended_property::notes:
1✔
374
        return "Notes";
2✔
375
    case extended_property::pages:
1✔
376
        return "Pages";
2✔
377
    case extended_property::paragraphs:
1✔
378
        return "Paragraphs";
2✔
379
    case extended_property::presentation_format:
1✔
380
        return "PresentationFormat";
2✔
381
    case extended_property::scale_crop:
42✔
382
        return "ScaleCrop";
84✔
383
    case extended_property::shared_doc:
42✔
384
        return "SharedDoc";
84✔
385
    case extended_property::slides:
1✔
386
        return "Slides";
2✔
387
    case extended_property::template_:
2✔
388
        return "Template";
4✔
389
    case extended_property::titles_of_parts:
42✔
390
        return "TitlesOfParts";
84✔
391
    case extended_property::total_time:
2✔
392
        return "TotalTime";
4✔
393
    case extended_property::words:
1✔
394
        return "Words";
2✔
395
    }
396

397
    default_case("Application");
×
398
}
399

400
std::string to_string(variant::type type)
44✔
401
{
402
    switch (type)
44!
403
    {
404
    case variant::type::boolean:
×
405
        return "bool";
×
406
    case variant::type::date:
×
407
        return "date";
×
408
    case variant::type::i4:
1✔
409
        return "i4";
2✔
410
    case variant::type::lpstr:
43✔
411
        return "lpstr";
86✔
412
    case variant::type::null:
×
413
        return "null";
×
414
    case variant::type::vector:
×
415
        return "vector";
×
416
    }
417

418
    default_case("null");
×
419
}
420

421
std::string to_string(pane_corner corner)
10✔
422
{
423
    switch (corner)
10!
424
    {
425
    case pane_corner::bottom_left:
2✔
426
        return "bottomLeft";
4✔
427
    case pane_corner::bottom_right:
6✔
428
        return "bottomRight";
12✔
429
    case pane_corner::top_left:
×
430
        return "topLeft";
×
431
    case pane_corner::top_right:
2✔
432
        return "topRight";
4✔
433
    }
434

435
    default_case("topLeft");
×
436
}
437

438
std::string to_string(target_mode mode)
×
439
{
440
    switch (mode)
×
441
    {
442
    case target_mode::external:
×
443
        return "External";
×
444
    case target_mode::internal:
×
445
        return "Internal";
×
446
    }
447

448
    default_case("Internal");
×
449
}
450

451
std::string to_string(pane_state state)
3✔
452
{
453
    switch (state)
3!
454
    {
455
    case pane_state::frozen:
3✔
456
        return "frozen";
6✔
457
    case pane_state::frozen_split:
×
458
        return "frozenSplit";
×
459
    case pane_state::split:
×
460
        return "split";
×
461
    }
462

463
    default_case("frozen");
×
464
}
465

466
std::string to_string(orientation orient)
8✔
467
{
468
    switch (orient)
8!
469
    {
470
    case xlnt::orientation::default_orientation:
×
471
        return "default";
×
472
    case xlnt::orientation::landscape:
×
473
        return "landscape";
×
474
    case xlnt::orientation::portrait:
8✔
475
        return "portrait";
16✔
476
    }
477
    default_case("default");
×
478
}
479

480
} // namespace detail
481
} // 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