forum-msg-id-128662-edit

Original date:2015-09-09 20:34:57 Edited by: ghaberek Subject: The libxlsxwriter library

I have completed wrapping libxlsxwriter and posted it to The Archive. This does require Euphoria 4.1 with memstruct support. There are a few structure-heavy elements to this library and it was a lot easier to wrap with memstruct instead of the ol' peek 'n' poke method. That being said, if there is enough interest in this library, I can put in some extra effort to make it compatible with Euphoria 4.0 as well. I have provided a Windows 32-bit DLL in the download. Linux users should be able to download the source and make/make install. I can try to provide 64-bit and Linux binaries if requested.

libxlsxwriter

Libxlsxwriter is a C library that can be used to write text, numbers, formulas and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file.

http://libxlsxwriter.github.io/demo.png

Sample code to create the above spreadsheet:

/* 
 * A simple example of some of the features of the libxlsxwriter library. 
 * 
 * Copyright 2014-2015, John McNamara, jmcnamara@cpan.org 
 * 
 */ 
 
include "xlsxwriter.e" 
 
procedure main() 
     
    /* Create a new workbook and add a worksheet. */ 
    atom workbook = new_workbook( "demo.xlsx" ) 
    atom worksheet = workbook_add_worksheet( workbook, NULL ) 
     
    /* Add a format. */ 
    atom format = workbook_add_format( workbook ) 
     
    /* Set the bold property for the format */ 
    format_set_bold( format ) 
     
    /* Widen the first column to make the text clearer. */ 
    worksheet_set_column( worksheet, {0, 0}, 20, NULL, NULL ) 
     
    /* Write some simple text. */ 
    worksheet_write_string( worksheet, {0, 0}, "Hello", NULL ) 
     
    /* Text with formatting. */ 
    worksheet_write_string( worksheet, {1, 0}, "World", format ) 
     
    /* Writer some numbers. */ 
    worksheet_write_number( worksheet, {2, 0}, 123,     NULL ) 
    worksheet_write_number( worksheet, {3, 0}, 123.456, NULL ) 
     
    workbook_close( workbook ) 
     
end procedure 

Get it here: libxlsxwriter.zip (144 KB)

-Greg

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu