Giter VIP home page Giter VIP logo

libxlsxwriter's People

Contributors

alexhuszagh avatar aymanbagabas avatar bvirlet avatar capuanob avatar dirkvdb avatar dotlambda avatar emaste avatar evanmiller avatar frankenapps avatar holgiho avatar j15e avatar jayaddison avatar jimzshi avatar jmcnamara avatar john-colvin avatar kassane avatar lrossi avatar mohd-akram avatar mpaladin avatar mrenters avatar mrmage avatar myd7349 avatar remicollet avatar sjmulder avatar tay10r avatar ulmentflam avatar yihuajack avatar zmodem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libxlsxwriter's Issues

Warning about redefinition of SLIST_ENTRY

The source file packager.c includes the header file windows.h. At least using Visual C++ 2010 I get a warning that the symbol SLIST_ENTRY is redefined in header file winnt.h which is indirectly included by windows.h. It's just a warning and the symbol is not used in packager.c, so no harm is done. However, it might be a good idea to rename the symbol in libxlsxwriter to something else to avoid name clashes (and thus potential problems).

Inconsistant constness of char* parameters

Many libxlsxwriter functions take text strings as parameters. The constness of those string parameters is used inconsistently. While sometimes const char* is used, several functions just use char*.

In my application I have string variables declared with const char*. At least for MSVC++ 2010 passing such variables to libxlsxwriter functions often result in the compiler message

error C2664: 'worksheet_set_header' : cannot convert parameter 2 from 'const char *' to 'char *'

At the moment I have only inspected the functions defined for workbooks and worksheets. That is, the following list of affected functions might be incomplete. Here is a list of functions that use char* parameters, but IMHO should use const char* instead, because they don't manipulate the strings passed to them, but usually just create a copy using strdup:

  • worksheet_set_header
  • worksheet_set_footer
  • worksheet_set_header_opt
  • worksheet_set_footer_opt
  • workbook_set_custom_property_string
  • workbook_set_custom_property_number
  • workbook_set_custom_property_integer
  • workbook_set_custom_property_boolean
  • workbook_set_custom_property_datetime
  • workbook_get_worksheet_by_name
  • worksheet_protect

Question regarding return type for functions returning an lxw_error

Many functions (like workbook or worksheet functions) return an lxw_error according to the documentation. However, the declared return type is uint8_t for the workbook functions resp. int8_t for the worksheet functions.

At the moment I have to use explicit type casts in my C++ application to avoid compiler warnings, when handling the error code returned from those functions.

Wouldn't it be better (and more logical and consistent) to use the enum type lxw_error as the return type for the functions in libxlsxwriter that return an lxw_error?

Feature request: worksheet_conditional_formatting()

Add worksheet_conditional_formatting() function like the Python XlsxWriter Worksheet method conditional_formatting().
See http://xlsxwriter.readthedocs.io/working_with_conditional_formats.html

  • Difficulty: 4 (Easy 1 - 5 Hard)
  • Priority: 2 (High 1 - 5 Low)

Add +1 as a comment to vote for this feature and to get an update when it is implemented.

If you would like to make a donation to accelerate this feature you can do so via PayPal or contact me directly. Currently $0 of $800.

Feature request: images in headers and footers

Add option to insert image in headers and footer like the Python XlsxWriter Worksheet methods set_header() and set_footer.
See https://xlsxwriter.readthedocs.org/page_setup.html#worksheet-set-header

  • Difficulty: 3 (Easy 1 - 5 Hard)
  • Priority: 3 (High 1 - 5 Low)

Add +1 as a comment to vote for this feature and to get an update when it is implemented.

If you would like to make a donation to accelerate this feature you can do so via PayPal or contact me directly. Currently $0 of $300.

optimize file does not get closed

Hi,

i think i found a bug. When using the the constant memory mode, the worksheet creates temporary files, as i can see this that files never get closed. After creating a large amount of worksheets (on iOS about 300), the system does not create new tempfiles and returns null instead, because there are too many (temp) files open.

Problem using libxlsxwriter and ZipArchive together

while i use pod libxlsxwriter and ZipArchive together
build would failed with "Use of undeclared identifier 'MAXU32'"
i think that because pod will misunderstand include ioapi.h at Ziparchive rather than libxlsxwriter
any idea to use these two together?

Memory leak while embedding C libxlsxwriter in Ruby

Hi! First of all, thank you for this wonderful lib.

I am trying to use it within my Ruby on Rails project by calling it using FFI. But, when deploying it to my production server, I am getting memory leaks that generate files which names contains some parts of the content of my .xlsx, not in the directory it was called, by in the root directory of my application.
Yesterday, I also got the problem:
[ERROR][packager.c:62]: Error opening zip file for xlsx
[ERROR][workbook.c:1108]: Memory allocation failed.

Do I have to grant writing permission recursively to the directories preceding the directory where the file is being generated? I there a way you would recommend me to simulate my production environment in order to effectively test the embedded lib?

Thanks in advance!

Eron

Feature request: worksheet_write_rich_string()

Add worksheet_write_rich_string() function like the Python XlsxWriter Worksheet method write_rich_string().
See https://xlsxwriter.readthedocs.io/example_rich_strings.html

  • Difficulty: 5 (Easy 1 - 5 Hard)
  • Priority: 2 (High 1 - 5 Low)

Add +1 as a comment to vote for this feature and to get an update when it is implemented.

If you would like to make a donation to accelerate this feature you can do so via PayPal or contact me directly. Currently $0 of $500.

Feature request: tmpdir

From https://xlsxwriter.readthedocs.org/workbook.html

  • "tmpdir: XlsxWriter stores worksheet data in a temporary files prior to assembling the final XLSX file. The temporary files are created in the systemโ€™s temp directory. If the default temporary directory isnโ€™t accessible to your application, or doesnโ€™t contain enough space, you can specify an alternative location using the tempdir option:"

Could you please add this option to your C library?

Thanks in advance,

Eron

Feature request: Per-cell indentation

Hi, I am currently porting code from xlslib over to libxlsxwriter. One of the incompatibilities I'm hitting is that xlslib allows setting certain attributes on a per-cell basis, including indentation and font, without explicitly defining a workbook-wide format.

I am unfamiliar with XLSX internals, but I would like to request the ability to set the indentation of each cell without having to define a separate format for that indentation level. Right now I am forced to create formats for the Cartesian product of (numeric format strings) x (indentation levels), and the code is getting hairy.

Feature request: Add other chart features

Add chart functions like the Python XlsxWriter module.
See https://xlsxwriter.readthedocs.org/index.html

Formatting:

  • Chart formatting: Line/Border
  • Chart formatting: Solid Fill
  • Chart formatting: Pattern Fill
  • Chart formatting: Fonts

Features:

  • Chart series option: Marker

  • Chart axes: Reverse

  • Chart axes: Max and min

  • Chart axes: Log base

Functions:

  • Chart set_legend()

  • Chart set_chartarea()

  • Chart set_plotarea()

  • Chart set_rotation()

  • Chart set_hole_size()

Add +1 as a comment to vote for the feature you would like and to get an update when it is implemented.

Issue with formatting

This is snippet from my code:

lxw_format *format = workbook_add_format(workbook);

format_set_font_color(format, 0xff0000); // set red color
worksheet_write_string(worksheet, 0, 0, "Red", format); // write to cell
format_set_font_color(format, 0x00ff00); // set green color
worksheet_write_string(worksheet, 0, 1, "Green", format); // write to another cell

why both cells have green font color?

worksheet_write_column api

Hi, I am about to start using your library, it is a god send that I don't have to do this from scratch, thank you!

After reading your API I have some concern about performance. I believe it would be easy to demonstrate as it is a well known issue with C API, a function call on an inner loop creates a bottleneck. Function calls themselves are rather heavy operation. Especially where memcpy would suffice.

I would like to know if you had planned on adding an API to set an entire column of data via a single call? If not I would like to propose it. Something along the lines of:

int8_t worksheet_write_column(lxw_worksheet *worksheet,
                              lxw_row_t num_rows,
                              lxw_col_t col_id, double *col_data,
                              lxw_format *format);
/*
worksheet - object to add the data to
num_rows - length of the array in rows
col_id - which column
col_data - pointer to c-array with one element per row
format - format object or NULL
*/

Given the loop structure illustrated in the doc section about memory and performance I believe such an API is compatible and would be almost trivial to add. Please let me know your thoughts on this issue.

Burlen

add cell sets wrong format

Hi,

consider this example:

    /* Add a worksheet. */
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    /* Widen the first column to make the text clearer. */
    worksheet_set_column(worksheet, 0, 0, 20, NULL, NULL);

    lxw_format *topLeftBottomFormat = workbook_add_format(workbook);
    format_set_font_size(topLeftBottomFormat, 14);
    format_set_font_name(topLeftBottomFormat, "Arial");
    format_set_bottom(topLeftBottomFormat, LXW_BORDER_MEDIUM);
    format_set_left(topLeftBottomFormat, LXW_BORDER_MEDIUM);
    format_set_top(topLeftBottomFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(topLeftBottomFormat, LXW_COLOR_BLACK);


    lxw_format *topBottomFormat = workbook_add_format(workbook);
    format_set_font_size(topBottomFormat, 14);
    format_set_font_name(topBottomFormat, "Arial");
    format_set_bottom(topBottomFormat, LXW_BORDER_MEDIUM);
    format_set_top(topBottomFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(topBottomFormat, LXW_COLOR_BLACK);


    lxw_format *topLeftFormat = workbook_add_format(workbook);
    format_set_font_size(topLeftFormat, 14);
    format_set_font_name(topLeftFormat, "Arial");
    format_set_left(topLeftFormat, LXW_BORDER_MEDIUM);
    format_set_top(topLeftFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(topLeftFormat, LXW_COLOR_BLACK);


    lxw_format *bottomLeftFormat = workbook_add_format(workbook);
    format_set_font_size(bottomLeftFormat, 14);
    format_set_font_name(bottomLeftFormat, "Arial");
    format_set_bottom(bottomLeftFormat, LXW_BORDER_MEDIUM);
    format_set_left(bottomLeftFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(bottomLeftFormat, LXW_COLOR_BLACK);


    lxw_format *leftFormat = workbook_add_format(workbook);
    format_set_font_size(leftFormat, 14);
    format_set_font_name(leftFormat, "Arial");
    format_set_left(leftFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(leftFormat, LXW_COLOR_BLACK);

    lxw_format *thinFormat = workbook_add_format(workbook);
    format_set_font_size(thinFormat, 14);
    format_set_font_name(thinFormat, "Arial");
    format_set_border(thinFormat, LXW_BORDER_THIN);
    format_set_border_color(thinFormat, LXW_COLOR_BLACK);
    format_set_align(thinFormat, LXW_ALIGN_CENTER);

    lxw_format *thinTopFormat = workbook_add_format(workbook);
    format_set_font_size(thinTopFormat, 14);
    format_set_font_name(thinTopFormat, "Arial");
    format_set_border(thinTopFormat, LXW_BORDER_THIN);
    format_set_top(thinTopFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(thinTopFormat, LXW_COLOR_BLACK);
    format_set_align(thinTopFormat, LXW_ALIGN_CENTER);

    lxw_format *thinBottomFormat = workbook_add_format(workbook);
    format_set_font_size(thinBottomFormat, 14);
    format_set_font_name(thinBottomFormat, "Arial");
    format_set_border(thinBottomFormat, LXW_BORDER_THIN);
    format_set_bottom(thinBottomFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(thinBottomFormat, LXW_COLOR_BLACK);
    format_set_align(thinBottomFormat, LXW_ALIGN_CENTER);

    worksheet_write_string(worksheet, 1, 20, "test", topLeftBottomFormat);
    worksheet_write_string(worksheet, 1, 22, "test", topLeftFormat);
    worksheet_write_string(worksheet, 1, 24, "test", topBottomFormat);
    worksheet_write_string(worksheet, 1, 26, "test", leftFormat);
    worksheet_write_string(worksheet, 1, 28, "test", bottomLeftFormat);
    worksheet_write_string(worksheet, 1, 30, "test", thinBottomFormat);
    worksheet_write_string(worksheet, 1, 32, "test", thinFormat);
    worksheet_write_string(worksheet, 1, 34, "test", thinTopFormat); 

This is the result i get:
excel_bug

You may note that the the cells are generated with the wrong format.
This is how it should look like:

excel_correct

I generated the second worksheet with this following code:

    /* Add a worksheet. */
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    /* Widen the first column to make the text clearer. */
    worksheet_set_column(worksheet, 0, 0, 20, NULL, NULL);

    lxw_format *topLeftBottomFormat = workbook_add_format(workbook);
    format_set_font_size(topLeftBottomFormat, 14);
    format_set_font_name(topLeftBottomFormat, "Arial");
    format_set_bottom(topLeftBottomFormat, LXW_BORDER_MEDIUM);
    format_set_left(topLeftBottomFormat, LXW_BORDER_MEDIUM);
    format_set_top(topLeftBottomFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(topLeftBottomFormat, LXW_COLOR_BLACK);

    lxw_format *topLeftFormat = workbook_add_format(workbook);
    format_set_font_size(topLeftFormat, 14);
    format_set_font_name(topLeftFormat, "Arial");
    format_set_left(topLeftFormat, LXW_BORDER_MEDIUM);
    format_set_top(topLeftFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(topLeftFormat, LXW_COLOR_BLACK);

    lxw_format *topBottomFormat = workbook_add_format(workbook);
    format_set_font_size(topBottomFormat, 14);
    format_set_font_name(topBottomFormat, "Arial");
    format_set_bottom(topBottomFormat, LXW_BORDER_MEDIUM);
    format_set_top(topBottomFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(topBottomFormat, LXW_COLOR_BLACK);

    lxw_format *leftFormat = workbook_add_format(workbook);
    format_set_font_size(leftFormat, 14);
    format_set_font_name(leftFormat, "Arial");
    format_set_left(leftFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(leftFormat, LXW_COLOR_BLACK);

    lxw_format *bottomLeftFormat = workbook_add_format(workbook);
    format_set_font_size(bottomLeftFormat, 14);
    format_set_font_name(bottomLeftFormat, "Arial");
    format_set_bottom(bottomLeftFormat, LXW_BORDER_MEDIUM);
    format_set_left(bottomLeftFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(bottomLeftFormat, LXW_COLOR_BLACK);

    lxw_format *thinBottomFormat = workbook_add_format(workbook);
    format_set_font_size(thinBottomFormat, 14);
    format_set_font_name(thinBottomFormat, "Arial");
    format_set_border(thinBottomFormat, LXW_BORDER_THIN);
    format_set_bottom(thinBottomFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(thinBottomFormat, LXW_COLOR_BLACK);
    format_set_align(thinBottomFormat, LXW_ALIGN_CENTER);

    lxw_format *thinFormat = workbook_add_format(workbook);
    format_set_font_size(thinFormat, 14);
    format_set_font_name(thinFormat, "Arial");
    format_set_border(thinFormat, LXW_BORDER_THIN);
    format_set_border_color(thinFormat, LXW_COLOR_BLACK);
    format_set_align(thinFormat, LXW_ALIGN_CENTER);

    lxw_format *thinTopFormat = workbook_add_format(workbook);
    format_set_font_size(thinTopFormat, 14);
    format_set_font_name(thinTopFormat, "Arial");
    format_set_border(thinTopFormat, LXW_BORDER_THIN);
    format_set_top(thinTopFormat, LXW_BORDER_MEDIUM);
    format_set_border_color(thinTopFormat, LXW_COLOR_BLACK);
    format_set_align(thinTopFormat, LXW_ALIGN_CENTER);



    worksheet_write_string(worksheet, 1, 20, "test", topLeftBottomFormat);
    worksheet_write_string(worksheet, 1, 22, "test", topLeftFormat);
    worksheet_write_string(worksheet, 1, 24, "test", topBottomFormat);
    worksheet_write_string(worksheet, 1, 26, "test", leftFormat);
    worksheet_write_string(worksheet, 1, 28, "test", bottomLeftFormat);
    worksheet_write_string(worksheet, 1, 30, "test", thinBottomFormat);
    worksheet_write_string(worksheet, 1, 32, "test", thinFormat);
    worksheet_write_string(worksheet, 1, 34, "test", thinTopFormat);

Here are the workbook_add_format calls in the same direction, as i later use this format in the worksheet_write_string call. This is not the case in the first code example. The bug happens with every worksheet_write_* method.
I also think that this is not bounded to the border style, rather to every style you can set (font, background color, ..).

This example is little bit large, i hope that the issue became clear to you.
This bug happens with and without memory optimization.
If you prioritize which issue you work first on, this is more important for me.
If there is something else i can do to help you, feel free to asks.

Thank you!

OSX yosemite make results in: unknown type name 'z_crc_t'

Unable to compile on OSX Yosemite

I installed both zlib from homebrew-dupes and minizip but I'm unable to use export flags in the Makefile.

Please advice.

> ~/projects/libxlsxwriter $ make
zip.c:160:11: error: unknown type name 'z_crc_t'
    const z_crc_t* pcrc_32_tab;
          ^
In file included from zip.c:186:
./crypt.h:35:53: error: unknown type name 'z_crc_t'
static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
                                                    ^
./crypt.h:48:51: error: unknown type name 'z_crc_t'
static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
                                                  ^
./crypt.h:65:69: error: unknown type name 'z_crc_t'
static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab)
                                                                    ^
./crypt.h:94:28: error: unknown type name 'z_crc_t'
                     const z_crc_t* pcrc_32_tab,
                           ^
5 errors generated.
make[1]: *** [zip.so] Error 1
make: *** [all] Error 2
``

IOS SWIFT integration

Hi, i installed the library in my swift project using cocoapods. I just add pod instructions in my podfile and then run "pod install". Now I can see the framework in my list of files, but i don't know how to use library inside my swift files...anyone can help me? I cannot find a working example of the code inside a swift project...

I try copying the sample code from documentation, but xcode says me that workbook type is undefined, etc...

Thank you, bye!

Crash in lxw_worksheet_assemble_xml_file

Hi, I am using libxlsxwriter 0.3.2 in a Mac program. I recently received a customer crash report that appears to originate inside libxlsxwriter. Here are the relevant bits:

Process:               Wizard [4171]
Path:                  /Applications/Wizard.app/Contents/MacOS/Wizard
Identifier:            org.evanmiller.wizard
Version:               1.8.11 (175)
App Item ID:           495152161
App External ID:       817409485
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Wizard [4171]
User ID:               501

Date/Time:             2016-05-25 14:43:33.330 -0700
OS Version:            Mac OS X 10.11.5 (15F34)
Report Version:        11
Anonymous UUID:        158C81F0-9849-BB26-6A96-7B2D4A3905A0

Sleep/Wake UUID:       5A3E1BB8-41CB-4875-B85C-8A54A252B403

Time Awake Since Boot: 190000 seconds
Time Since Wake:       18000 seconds

System Integrity Protection: enabled

Crashed Thread:        7

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000068
Exception Note:        EXC_CORPSE_NOTIFY

[snip]

Thread 7 Crashed:
0   libsystem_c.dylib               0x00007fff8f2fa0a5 flockfile + 4
1   libsystem_c.dylib               0x00007fff8f2fd2f9 fwrite + 72
2   libxlsxwriter.dylib             0x000000010e126145 lxw_worksheet_assemble_xml_file + 53
3   libxlsxwriter.dylib             0x000000010e11c70b lxw_create_package + 203
4   libxlsxwriter.dylib             0x000000010e122ce5 workbook_close + 1285
5   org.evanmiller.wizard           0x000000010dc3f338 0x10db5a000 + 938808
6   org.evanmiller.wizard           0x000000010dc51911 0x10db5a000 + 1014033
7   com.apple.CoreFoundation        0x00007fff8e08aa6c __invoking___ + 140
8   com.apple.CoreFoundation        0x00007fff8e08a8fe -[NSInvocation invoke] + 286
9   com.apple.Foundation            0x00007fff88c496cb -[NSInvocationOperation main] + 34
10  com.apple.Foundation            0x00007fff88bd5c7a -[__NSOperationInternal _start:] + 654
11  com.apple.Foundation            0x00007fff88bd1c64 __NSOQSchedule_f + 194
12  libdispatch.dylib               0x00007fff9a34540b _dispatch_client_callout + 8
13  libdispatch.dylib               0x00007fff9a34a03b _dispatch_queue_drain + 754
14  libdispatch.dylib               0x00007fff9a350707 _dispatch_queue_invoke + 549
15  libdispatch.dylib               0x00007fff9a348d53 _dispatch_root_queue_drain + 538
16  libdispatch.dylib               0x00007fff9a348b00 _dispatch_worker_thread3 + 91
17  libsystem_pthread.dylib         0x00007fff99e894de _pthread_wqthread + 1129
18  libsystem_pthread.dylib         0x00007fff99e87341 start_wqthread + 13

It looks like there is a NULL pointer being dereferenced as part of a struct. I am not sure if it matters but the code is running on a background thread. I received the crash report automatically via Apple so I'm afraid I can't provide more details about the crash conditions.

Feature request:add border line functions

I just put your library into my Xcode project and it works just fine. Thank you for your great lib.
But I have to draw border lines of cells for users want this feature as a formal excel document.
Is it possible?

VC++ 2010 and earlier don't define snprintf

Unfortunately MSVC++ 2010 and earlier don't define the function snprintf ... and what's worse, the function _snprintf provided by MSVC++ 2010 can't be used as a replacement, since it behaves differently than snprintf. One way to solve the problem is to define a function with the proper behaviour in the header file common.h of libxlsxwriter. After line 235 add the following code:

/* VC++ 2010 doesn't define snprintf */
#if defined(_MSC_VER) && _MSC_VER < 1900

#define snprintf c99_snprintf
#define vsnprintf c99_vsnprintf

#include <stdarg.h>

__inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap)
{
    int count = -1;

    if (size != 0)
        count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap);
    if (count == -1)
        count = _vscprintf(format, ap);

    return count;
}

__inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...)
{
    int count;
    va_list ap;

    va_start(ap, format);
    count = c99_vsnprintf(outBuf, size, format, ap);
    va_end(ap);

    return count;
}

#endif 

This makes libxlsxwriter operational with MSVC++ 2010 and earlier.

How to build libxlsxwriter on Windows with MinGW-w64?

Hello,

First, thanks for this awesome library, I've tested it on my Xubuntu and I'm impressed with its quality!

So, I'm trying to build libxlsxwriter (latest release, 0.3.8), but I'm not sure about my steps, that was:

pacman -S zlib-devel
...
make CC=gcc > log.txt

The result:

packager.so: In function `open_zipfile_win32':
C:\msys32\home\silvioprog\libxlsxwriter-RELEASE_0.3.8\src/packager.c:49: undefined reference to `fill_win32_filefunc64'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [libxlsxwriter.so] Error 1
make: *** [all] Error 2

And the log.txt content:

make[1]: Entering directory '/home/silvioprog/libxlsxwriter-RELEASE_0.3.8/third_party/minizip'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/silvioprog/libxlsxwriter-RELEASE_0.3.8/third_party/minizip'
make[1]: Entering directory '/home/silvioprog/libxlsxwriter-RELEASE_0.3.8/src'
Makefile:67: recipe for target 'libxlsxwriter.so' failed
make[1]: Leaving directory '/home/silvioprog/libxlsxwriter-RELEASE_0.3.8/src'
Makefile:18: recipe for target 'all' failed

So, can I build libxlsxwriter with MinGW-w64 on Windows? If so, which commands I need perform?!

Thank you!

Library raises a misleading error when the file isn't writeable

The following misleading errors are usually generated when the output file or directory isn't writeable:

cd libxlsxwriter
make examples
./examples/hello
# Creates hello_world.xlsx

chmod -w hello_world.xlsx
./examples/hello

[ERROR][packager.c:62]: Error opening zip file for xlsx
[ERROR][workbook.c:1108]: Memory allocation failed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.