-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
5,684 additions
and
1,436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* libxlsxwriter | ||
* | ||
* Copyright 2014-2021, John McNamara, [email protected]. See LICENSE.txt. | ||
* Copyright 2014-2022, John McNamara, [email protected]. See LICENSE.txt. | ||
*/ | ||
|
||
/** | ||
|
@@ -18,7 +18,8 @@ | |
#include "xlsxwriter/format.h" | ||
#include "xlsxwriter/utility.h" | ||
|
||
#define LXW_VERSION "1.0.3" | ||
#define LXW_VERSION_ID 103 | ||
#define LXW_VERSION "1.1.5" | ||
#define LXW_VERSION_ID 115 | ||
#define LXW_SOVERSION "5" | ||
|
||
#endif /* __LXW_XLSXWRITER_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* libxlsxwriter | ||
* | ||
* Copyright 2014-2021, John McNamara, [email protected]. See LICENSE.txt. | ||
* Copyright 2014-2022, John McNamara, [email protected]. See LICENSE.txt. | ||
* | ||
* app - A libxlsxwriter library for creating Excel XLSX app files. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* libxlsxwriter | ||
* | ||
* Copyright 2014-2021, John McNamara, [email protected]. See LICENSE.txt. | ||
* Copyright 2014-2022, John McNamara, [email protected]. See LICENSE.txt. | ||
* | ||
* chart - A libxlsxwriter library for creating Excel XLSX chart files. | ||
* | ||
|
@@ -699,7 +699,7 @@ typedef struct lxw_chart_pattern { | |
typedef struct lxw_chart_font { | ||
|
||
/** The chart font name, such as "Arial" or "Calibri". */ | ||
char *name; | ||
const char *name; | ||
|
||
/** The chart font size. The default is 11. */ | ||
double size; | ||
|
@@ -713,9 +713,12 @@ typedef struct lxw_chart_font { | |
/** The chart font underline property. Set to 0 or 1. */ | ||
uint8_t underline; | ||
|
||
/** The chart font rotation property. Range: -90 to 90, and 270-271. | ||
* The angle 270 gives a stacked (top to bottom) alignment. | ||
* The angle 271 gives a stacked alignment for East Asian fonts. | ||
/** The chart font rotation property. Range: -90 to 90, and 270, 271 and 360: | ||
* | ||
* - The angles -90 to 90 are the normal range shown in the Excel user interface. | ||
* - The angle 270 gives a stacked (top to bottom) alignment. | ||
* - The angle 271 gives a stacked alignment for East Asian fonts. | ||
* - The angle 360 gives an explicit angle of 0 to override the y axis default. | ||
* */ | ||
int32_t rotation; | ||
|
||
|
@@ -797,7 +800,7 @@ typedef struct lxw_chart_data_label { | |
|
||
/** The string or formula value for the data label. See | ||
* @ref chart_custom_labels. */ | ||
char *value; | ||
const char *value; | ||
|
||
/** Option to hide/delete the data label from the chart series. | ||
* See @ref chart_custom_labels. */ | ||
|
@@ -3232,14 +3235,28 @@ void chart_title_set_name_range(lxw_chart *chart, const char *sheetname, | |
* chart title: | ||
* | ||
* @code | ||
* lxw_chart_font font = {.bold = LXW_TRUE, .color = LXW_COLOR_BLUE}; | ||
* lxw_chart_font font = {.color = LXW_COLOR_BLUE}; | ||
* | ||
* chart_title_set_name(chart, "Year End Results"); | ||
* chart_title_set_name_font(chart, &font); | ||
* @endcode | ||
* | ||
* @image html chart_title_set_name_font.png | ||
* | ||
* In Excel a chart title font is bold by default (as shown in the image | ||
* above). To turn off bold in the font you cannot use #LXW_FALSE (0) since | ||
* that is indistinguishable from an uninitialized value. Instead you should | ||
* use #LXW_EXPLICIT_FALSE: | ||
* | ||
* @code | ||
* lxw_chart_font font = {.bold = LXW_EXPLICIT_FALSE, .color = LXW_COLOR_BLUE}; | ||
* | ||
* chart_title_set_name(chart, "Year End Results"); | ||
* chart_title_set_name_font(chart, &font); | ||
* @endcode | ||
* | ||
* @image html chart_title_set_name_font2.png | ||
* | ||
* For more information see @ref chart_fonts. | ||
*/ | ||
void chart_title_set_name_font(lxw_chart *chart, lxw_chart_font *font); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* libxlsxwriter | ||
* | ||
* Copyright 2014-2021, John McNamara, [email protected]. See LICENSE.txt. | ||
* Copyright 2014-2022, John McNamara, [email protected]. See LICENSE.txt. | ||
* | ||
* chartsheet - A libxlsxwriter library for creating Excel XLSX chartsheet files. | ||
* | ||
|
@@ -80,10 +80,10 @@ typedef struct lxw_chartsheet { | |
struct lxw_protection_obj protection; | ||
uint8_t is_protected; | ||
|
||
char *name; | ||
char *quoted_name; | ||
char *tmpdir; | ||
uint32_t index; | ||
const char *name; | ||
const char *quoted_name; | ||
const char *tmpdir; | ||
uint16_t index; | ||
uint8_t active; | ||
uint8_t selected; | ||
uint8_t hidden; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* libxlsxwriter | ||
* | ||
* Copyright 2014-2021, John McNamara, [email protected]. See LICENSE.txt. | ||
* Copyright 2014-2022, John McNamara, [email protected]. See LICENSE.txt. | ||
* | ||
* comment - A libxlsxwriter library for creating Excel XLSX comment files. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
/* | ||
* libxlsxwriter | ||
* | ||
* Copyright 2014-2021, John McNamara, [email protected]. See LICENSE.txt. | ||
* Copyright 2014-2022, John McNamara, [email protected]. See LICENSE.txt. | ||
*/ | ||
|
||
/** | ||
* @file common.h | ||
* | ||
* @brief Common functions and defines for the libxlsxwriter library. | ||
* | ||
* <!-- Copyright 2014-2021, John McNamara, [email protected] --> | ||
* <!-- Copyright 2014-2022, John McNamara, [email protected] --> | ||
* | ||
*/ | ||
#ifndef __LXW_COMMON_H__ | ||
|
@@ -50,7 +50,10 @@ enum lxw_boolean { | |
/** False value. */ | ||
LXW_FALSE, | ||
/** True value. */ | ||
LXW_TRUE | ||
LXW_TRUE, | ||
/** False value. Used to turn off a property that is default on, in order | ||
* to distinguish it from an uninitialized value. */ | ||
LXW_EXPLICIT_FALSE | ||
}; | ||
|
||
/** | ||
|
@@ -203,7 +206,7 @@ enum lxw_custom_property_types { | |
#define LXW_DATETIME_LENGTH sizeof("2016-12-12T23:00:00Z") | ||
|
||
/* GUID string length. */ | ||
#define LXW_GUID_LENGTH sizeof("{12345678-1234-1234-1234-1234567890AB}") | ||
#define LXW_GUID_LENGTH sizeof("{12345678-1234-1234-1234-1234567890AB}\0") | ||
|
||
#define LXW_EPOCH_1900 0 | ||
#define LXW_EPOCH_1904 1 | ||
|
@@ -223,13 +226,14 @@ enum lxw_custom_property_types { | |
#define LXW_SCHEMA_DOCUMENT LXW_SCHEMA_ROOT "/officeDocument/2006/relationships" | ||
#define LXW_SCHEMA_CONTENT LXW_SCHEMA_ROOT "/package/2006/content-types" | ||
|
||
/* Use REprintf() for error handling when compiled as an R library. */ | ||
#ifdef USE_R_LANG | ||
#include <R.h> | ||
#define LXW_PRINTF REprintf | ||
#define LXW_STDERR | ||
#define LXW_PRINTF REprintf | ||
#define LXW_STDERR | ||
#else | ||
#define LXW_PRINTF fprintf | ||
#define LXW_STDERR stderr, | ||
#define LXW_PRINTF fprintf | ||
#define LXW_STDERR stderr, | ||
#endif | ||
|
||
#define LXW_ERROR(message) \ | ||
|
@@ -239,32 +243,42 @@ enum lxw_custom_property_types { | |
LXW_ERROR("Memory allocation failed.") | ||
|
||
#define GOTO_LABEL_ON_MEM_ERROR(pointer, label) \ | ||
if (!pointer) { \ | ||
LXW_MEM_ERROR(); \ | ||
goto label; \ | ||
} | ||
do { \ | ||
if (!pointer) { \ | ||
LXW_MEM_ERROR(); \ | ||
goto label; \ | ||
} \ | ||
} while (0) | ||
|
||
#define RETURN_ON_MEM_ERROR(pointer, error) \ | ||
if (!pointer) { \ | ||
LXW_MEM_ERROR(); \ | ||
return error; \ | ||
} | ||
do { \ | ||
if (!pointer) { \ | ||
LXW_MEM_ERROR(); \ | ||
return error; \ | ||
} \ | ||
} while (0) | ||
|
||
#define RETURN_VOID_ON_MEM_ERROR(pointer) \ | ||
if (!pointer) { \ | ||
LXW_MEM_ERROR(); \ | ||
return; \ | ||
} | ||
do { \ | ||
if (!pointer) { \ | ||
LXW_MEM_ERROR(); \ | ||
return; \ | ||
} \ | ||
} while (0) | ||
|
||
#define RETURN_ON_ERROR(error) \ | ||
if (error) \ | ||
return error; | ||
do { \ | ||
if (error) \ | ||
return error; \ | ||
} while (0) | ||
|
||
#define RETURN_AND_ZIPCLOSE_ON_ERROR(error) \ | ||
if (error) { \ | ||
zipClose(self->zipfile, NULL); \ | ||
return error; \ | ||
} | ||
do { \ | ||
if (error) { \ | ||
zipClose(self->zipfile, NULL); \ | ||
return error; \ | ||
} \ | ||
} while (0) | ||
|
||
#define LXW_WARN(message) \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " message "\n") | ||
|
@@ -279,52 +293,67 @@ enum lxw_custom_property_types { | |
#define LXW_WARN_FORMAT2(message, var1, var2) \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " message "\n", var1, var2) | ||
|
||
#define LXW_WARN_FORMAT3(message, var1, var2, var3) \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " message "\n", var1, var2, var3) | ||
|
||
/* Chart axis type checks. */ | ||
#define LXW_WARN_CAT_AXIS_ONLY(function) \ | ||
if (!axis->is_category) { \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " \ | ||
function "() is only valid for category axes\n"); \ | ||
return; \ | ||
} | ||
do { \ | ||
if (!axis->is_category) { \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " \ | ||
function "() is only valid for category axes\n"); \ | ||
return; \ | ||
} \ | ||
} while (0) | ||
|
||
#define LXW_WARN_VALUE_AXIS_ONLY(function) \ | ||
if (!axis->is_value) { \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " \ | ||
do { \ | ||
if (!axis->is_value) { \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " \ | ||
function "() is only valid for value axes\n"); \ | ||
return; \ | ||
} | ||
return; \ | ||
} \ | ||
} while (0) | ||
|
||
#define LXW_WARN_DATE_AXIS_ONLY(function) \ | ||
if (!axis->is_date) { \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " \ | ||
function "() is only valid for date axes\n"); \ | ||
return; \ | ||
} | ||
do { \ | ||
if (!axis->is_date) { \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " \ | ||
function "() is only valid for date axes\n"); \ | ||
return; \ | ||
} \ | ||
} while (0) | ||
|
||
#define LXW_WARN_CAT_AND_DATE_AXIS_ONLY(function) \ | ||
if (!axis->is_category && !axis->is_date) { \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " \ | ||
do { \ | ||
if (!axis->is_category && !axis->is_date) { \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " \ | ||
function "() is only valid for category and date axes\n"); \ | ||
return; \ | ||
} | ||
return; \ | ||
} \ | ||
} while (0) | ||
|
||
#define LXW_WARN_VALUE_AND_DATE_AXIS_ONLY(function) \ | ||
if (!axis->is_value && !axis->is_date) { \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " \ | ||
do { \ | ||
if (!axis->is_value && !axis->is_date) { \ | ||
LXW_PRINTF(LXW_STDERR "[WARNING]: " \ | ||
function "() is only valid for value and date axes\n"); \ | ||
return; \ | ||
} | ||
return; \ | ||
} \ | ||
} while (0) | ||
|
||
#ifndef LXW_BIG_ENDIAN | ||
#define LXW_UINT16_HOST(n) (n) | ||
#define LXW_UINT32_HOST(n) (n) | ||
#define LXW_UINT16_NETWORK(n) ((((n) & 0x00FF) << 8) | (((n) & 0xFF00) >> 8)) | ||
#define LXW_UINT32_NETWORK(n) ((((n) & 0xFF) << 24) | \ | ||
(((n) & 0xFF00) << 8) | \ | ||
(((n) & 0xFF0000) >> 8) | \ | ||
(((n) & 0xFF000000) >> 24)) | ||
#define LXW_UINT16_NETWORK(n) ((((n) & 0x00FF) << 8) | (((n) & 0xFF00) >> 8)) | ||
#define LXW_UINT32_HOST(n) (n) | ||
#else | ||
#define LXW_UINT32_NETWORK(n) (n) | ||
#define LXW_UINT16_NETWORK(n) (n) | ||
#define LXW_UINT32_NETWORK(n) (n) | ||
#define LXW_UINT16_HOST(n) ((((n) & 0x00FF) << 8) | (((n) & 0xFF00) >> 8)) | ||
#define LXW_UINT32_HOST(n) ((((n) & 0xFF) << 24) | \ | ||
(((n) & 0xFF00) << 8) | \ | ||
(((n) & 0xFF0000) >> 8) | \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* libxlsxwriter | ||
* | ||
* Copyright 2014-2021, John McNamara, [email protected]. See LICENSE.txt. | ||
* Copyright 2014-2022, John McNamara, [email protected]. See LICENSE.txt. | ||
* | ||
* content_types - A libxlsxwriter library for creating Excel XLSX | ||
* content_types files. | ||
|
@@ -53,13 +53,16 @@ void lxw_ct_add_chart_name(lxw_content_types *content_types, | |
const char *name); | ||
void lxw_ct_add_drawing_name(lxw_content_types *content_types, | ||
const char *name); | ||
void lxw_ct_add_table_name(lxw_content_types *content_types, | ||
const char *name); | ||
void lxw_ct_add_comment_name(lxw_content_types *content_types, | ||
const char *name); | ||
void lxw_ct_add_vml_name(lxw_content_types *content_types); | ||
|
||
void lxw_ct_add_shared_strings(lxw_content_types *content_types); | ||
void lxw_ct_add_calc_chain(lxw_content_types *content_types); | ||
void lxw_ct_add_custom_properties(lxw_content_types *content_types); | ||
void lxw_ct_add_metadata(lxw_content_types *content_types); | ||
|
||
/* Declarations required for unit testing. */ | ||
#ifdef TESTING | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* libxlsxwriter | ||
* | ||
* Copyright 2014-2021, John McNamara, [email protected]. See LICENSE.txt. | ||
* Copyright 2014-2022, John McNamara, [email protected]. See LICENSE.txt. | ||
* | ||
* core - A libxlsxwriter library for creating Excel XLSX core files. | ||
* | ||
|
Oops, something went wrong.