1. 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. Update: Now supports all 32-bit Euhporia! (4.0/4.1) Just add with define MEMSTRUCT before including xlsxwriter.e in your 4.1 in order to use memstructs.

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

new topic     » topic index » view message » categorize

2. Re: The libxlsxwriter library

ghaberek said...

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.

[...]

-Greg

A really big THANK YOU!

But memstructs (as much as i like them) are not on the roadmap for Eu4.1, as far as i know.
There is not even a Beta release or something.

For myself, i need a stable base. Also i mostly write 'throw away code' (means code that is used once ore twice to solve a special problem).

So i would prefer a 4.0 or a 4.1 (more the 4.0) version.
(from the Windows side, a 32bit Watcom binary works nice from XP to Win10, on both 32bit and 64bit hosts).
For sure, this is up to you.

Andreas

new topic     » goto parent     » topic index » view message » categorize

3. Re: The libxlsxwriter library

andi49 said...

So i would prefer a 4.0 or a 4.1 (more the 4.0) version.

This won't really be too difficult; it will just take more time. Bear with me and I'll have it ready soon.

andi49 said...

(from the Windows side, a 32bit Watcom binary works nice from XP to Win10, on both 32bit and 64bit hosts).

The Euphoria developers don't really support OpenWatcom any more AFAIK. I built this with 32-bit TDM-GCC 4.8.1 (aka MinGW).

-Greg

new topic     » goto parent     » topic index » view message » categorize

4. Re: The libxlsxwriter library

andi49 said...

But memstructs (as much as i like them) are not on the roadmap for Eu4.1, as far as i know.
There is not even a Beta release or something.

I think structs are on the EuphoriaRoadmap for 4.1.

new topic     » goto parent     » topic index » view message » categorize

5. Re: The libxlsxwriter library

xecronix said...

I think structs are on the EuphoriaRoadmap for 4.1.

I believe Jim said that 4.1 is currently feature-frozen for release without memstruct. So we can more likely expect memstruct in 4.2. (circa 2018?)

-Greg

new topic     » goto parent     » topic index » view message » categorize

6. Re: The libxlsxwriter library

ghaberek said...
xecronix said...

I think structs are on the EuphoriaRoadmap for 4.1.

I believe Jim said that 4.1 is currently feature-frozen for release without memstruct. So we can more likely expect memstruct in 4.2. (circa 2018?)

-Greg

If there's enough demand, and if Matt's willing to do the merge, I think we could make an exception for this one case.

The reason for the feature freeze was to get 4.1.0 out the door faster, but it doesn't really seem to have helped.

new topic     » goto parent     » topic index » view message » categorize

7. Re: The libxlsxwriter library

andi49 said...

But memstructs (as much as i like them) are not on the roadmap for Eu4.1, as far as i know.
There is not even a Beta release or something.

My Windows 32-bit All-ii-One package uses EU41 with memstruct:

http://rapideuphoria.com/euphoria32_for_win64_with_win32lib_and_wxeuphoria.zip

I tried the libxlswriter library with it and it works.

Regards

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

8. Re: The libxlsxwriter library

jimcbrown said...

If there's enough demand, and if Matt's willing to do the merge, I think we could make an exception for this one case.

The reason for the feature freeze was to get 4.1.0 out the door faster, but it doesn't really seem to have helped.

That would be swell. This is a good example of how I was able to kick out a wrapper for something much faster using memstruct instead of the "classic" method.

We still have some limitations when it comes to structures (such as passing them on the stack) but this is a big step forward.

jmduro said...

My Windows 32-bit All-ii-One package uses EU41 with memstruct:

http://rapideuphoria.com/euphoria32_for_win64_with_win32lib_and_wxeuphoria.zip

I tried the libxlswriter library with it and it works.

Neat! Thanks for testing. smile

-Greg

new topic     » goto parent     » topic index » view message » categorize

9. Re: The libxlsxwriter library

Updated: added support for non-memstruct Euphoria (4.0, 4.1).

http://www.rapideuphoria.com/libxlsxwriter.zip (145 KB)

-Greg

new topic     » goto parent     » topic index » view message » categorize

10. Re: The libxlsxwriter library

ghaberek said...

Updated: added support for non-memstruct Euphoria (4.0, 4.1).

http://www.rapideuphoria.com/libxlsxwriter.zip (145 KB)

-Greg

Hi

it works great using memstruct, but i can't get it to work with eu4.0 maybe a setup problem on my side.
i have not testet with 4.1 without memstruct.

But again THANK YOU. It's really what i needed.

Andreas

new topic     » goto parent     » topic index » view message » categorize

11. Re: The libxlsxwriter library

andi49 said...

it works great using memstruct, but i can't get it to work with eu4.0 maybe a setup problem on my side.
i have not testet with 4.1 without memstruct.

Curious. What problem are you having? Maybe I or someone else here can help if you need.

andi49 said...

But again THANK YOU. It's really what i needed.

Glad to be of service. I stumbled across this library when I used the Python version for a project at work.

When I found the C library version, I immediately set out to get it wrapped in Euphoria, thinking "I know someone will have a need for this!"

-Greg

new topic     » goto parent     » topic index » view message » categorize

12. Re: The libxlsxwriter library

ghaberek said...
andi49 said...

it works great using memstruct, but i can't get it to work with eu4.0 maybe a setup problem on my side.
i have not testet with 4.1 without memstruct.

Curious. What problem are you having? Maybe I or someone else here can help if you need.

The Parser seems to crash on dot ntotation even if it is in a ifdef ... end ifdef.
(on EU4.0.6 from the repo compiled with Watcom)

commenting out the lines works. like this:

ifdef MEMSTRUCT then 
		 
		--atom worksheets = workbook.lxw_workbook.worksheets 
		--atom next = worksheets.stailq_head.stqh_first 
		 
		while next != NULL do 
			result = append( result, next ) 
		--	next = next.lxw_worksheet.list_pointers.stqe_next 
		end while 
		 
	elsedef 

The same is true for Eu4.1 from the repo (tip) compiled with gcc 4.9.2

Andreas

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu