brechtsanders / xlsxio

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

After using xlsxioread_sheet_open, cannot use xlsxioread_sheetlist_next to get the next sheet #128

Open xiaoyuantao opened 3 months ago

xiaoyuantao commented 3 months ago

After using xlsxioread_sheet_open, cannot use xlsxioread_sheetlist_next to get the next sheet. Here's my code. I want to go through all the sheets and print out the contents. But the actual effect really only prints the contents of the first sheet

if ((sheetlist = xlsxioread_sheetlist_open(xlsxioread)) != NULL) 
  {
    while((sheetname = xlsxioread_sheetlist_next(sheetlist)) != NULL)
    {
      XML_Char_printf(X("%p - %s\n"),(void *)sheetname,sheetname);
      sheet = xlsxioread_sheet_open(xlsxioread, sheetname, XLSXIOREAD_SKIP_EMPTY_ROWS);
      if(sheet != NULL)
      {
          while (xlsxioread_sheet_next_row(sheet)) {
              while ((value = xlsxioread_sheet_next_cell(sheet)) != NULL) {
              XML_Char_printf(X("%s\t"), value);
              xlsxioread_free(value);
              }
              printf("\n");
          }
          xlsxioread_sheet_close(sheet);
      }
    }
    XML_Char_printf(X("AA%p - %s\n"),(void *)sheetname,sheetname);

    xlsxioread_sheetlist_close(sheetlist);
  }

image

ReanRelay commented 1 month ago

I have 8 worksheets and can only get 2 worksheets, for some reason, using x64 binary file, version 0.2.35

brechtsanders commented 1 month ago

@ReanRelay Can you share a .xlsx file with this issue so I can investigate?

80588345 commented 1 week ago

I have 5 sheets, but get only 1 sheets. any xlxs‘ files