brechtsanders / xlsxio

XLSX I/O - C library for reading and writing .xlsx files
MIT License
417 stars 112 forks source link

Feat: get read sheet information #63

Closed viest closed 4 years ago

viest commented 4 years ago

Exposing the coordinates of the currently read cell to the outside, so that the application can obtain the actual cell position.

viest commented 4 years ago

see https://github.com/viest/php-ext-xlswriter/blob/master/kernel/read.c#L233 see https://github.com/viest/php-ext-xlswriter/blob/master/kernel/read.c#L218

remicollet commented 4 years ago

@brechtsanders ping

brechtsanders commented 4 years ago

Hi, Sorry for not replying right away but I couldn't make sense of wich part of the code you actually modified. Can you explain? Because it is quite easy for me add a function to get the coordinates of the next cell that will be written. Are you just looking for row/column in numbers, or for Excel coordinates like "A1"? Regards Brecht

viest commented 4 years ago

Hi, @brechtsanders

When I use the xlsxioread_sheet_next_cell interface to get cell data, I don't know the column of the current cell, so I added this method;

This becomes very important if I use the skip flag;

brechtsanders commented 4 years ago

Somehow I can't see the diff with your code and the original code. There is no kernel/read.c in the original code. Can you point me to the exact code/function you added?

remicollet commented 4 years ago

@brechtsanders see the diff of this PR https://github.com/brechtsanders/xlsxio/pull/63.patch

xlsxioread_sheet_last_column_index and xlsxioread_sheet_flags functions (and lot of noise related to CR/LF)

remicollet commented 4 years ago

Or simply opening the right tab.... https://github.com/brechtsanders/xlsxio/pull/63/files

And link from @viest is to show how this new functions are used in his project

brechtsanders commented 4 years ago

After looking at the change I changed the type to size_t, as there was no reason to change this to a signed int. I also added xlsxioread_sheet_last_row_index() as I figured that would also make sense and it was just as easy to add.