brechtsanders / xlsxio

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

XLSXIOREADER_SKIP_* flags not working for files saves via OpenOffice calc #74

Closed Chiorufarewerin closed 4 years ago

Chiorufarewerin commented 4 years ago

When i save file in OpenOffice Calc, creates xml for row like this

<row r="3" customFormat="false" ht="13.8" hidden="false" customHeight="false" outlineLevel="0" collapsed="false">
    <c r="A3" s="2"/>
    <c r="B3" s="2"/>
    <c r="C3" s="2"/>
    <c r="D3" s="3"/>
    <c r="E3" s="2"/>
    <c r="F3" s="2"/>
    <c r="G3" s="4"/>
    <c r="H3" s="2"/>
</row>

File saves via excel not contains that row.

brechtsanders commented 4 years ago

I don't understand your question/issue. Can you tell me what the output from XLSX I/O is and what you expect it to be and why?

Chiorufarewerin commented 4 years ago

File: https://drive.google.com/file/d/1KWIoFolYXIFmG4Cd2cykMY2qNGeJXnsI/view?usp=sharing

Code:

int main() {
    xlsxioreader xlsxioread;
    const char filename[] = "test_file_base.xlsx";

    if ((xlsxioread = xlsxioread_open(filename)) == NULL) {
        return 1;
    }
    char* value;
    xlsxioreadersheet sheet;
    if ((sheet = xlsxioread_sheet_open(xlsxioread, NULL, XLSXIOREAD_SKIP_ALL_EMPTY)) != NULL) {
        while (xlsxioread_sheet_next_row(sheet)) {
            while ((value = xlsxioread_sheet_next_cell(sheet)) != NULL) {
                printf("%s\t", value);
                free(value);
            }
            printf("\n");
        }
        xlsxioread_sheet_close(sheet);
    }
    xlsxioread_close(xlsxioread);
}

Output:


1       Jayden  Young   20640   64      85844.5 42950.8387268518        1

6       Greyson                 35      14000   42985.2641087963        0
7       Evan    Flores  37793   17      18000   43844.1375925926        0
8       Ian     Taylor                          43331.4207291667        0
                        30374   37      92551   43113.893912037 0

Expect: not printing empty cells and rows, because sent flags XLSXIOREAD_SKIP_ALL_EMPTY

brechtsanders commented 4 years ago

Thank you for clarifying. There were indeed a number of issues with regards to skipping empty cells and lines. They have now been fixed in release 0.2.27.