-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Row.cells does not include empty cells. #107
Comments
Hey @matzsoft, in the XLSX format there's a difference between an empty cell and absence of a cell, like a difference between Please also see a similar conversation here. Does that resolve your issue? |
Hey Max, you are of course correct about the structure of the XML and why they chose to implement it that way. And if your intent is to have CoreXLSX reflect the structure of the XML rather than the spreadsheet that it abstracts, then that is the way the library should behave. However I am more interested in the table structure of the spreadsheet and need those missing cells to be there in the data I'm extracting. So here is a simple suggested patch that would make it easier for me to do that. In ColumnReference.swift at line 13, make intValue public. Then in my
Thanks. |
Sorry, after re-reading this I'm not sure I'm completely following how would you like it to work? Could you post a bigger code snippet of how you want the API to look like? |
Sure thing. Here's my file ExcelTable.swift after I made my suggested patch to ColumnReference.swift. After the patch I was able to create the extension for WorkSheet and add the two
and now it does what I need. Let me know if you have any other questions. |
Hi for (index, cell) in row.cells.enumerated() giving 6 cells in first row and 4 cells in second row as I have empty cells in second row. how can I get rows[1].cells.count = 6 (including empty rows). |
i have this problem too :( make me headache |
You found any solution? |
I would like to reiterate that an empty cell and absence of a cell are different things. If you're not getting a cell or a row during the iteration, this means that there is no such cell or row in your document. The document should have empty cells and rows written in it in the first place for you to be able to read them. |
Because of absence of cell we have index problem. in first row I have email at index 3. in second row I have email at index 2. |
You should not address cells via their indices in an array of cells. Every cell has a |
Thanks @MaxDesiatov it is working now... |
Sorry, I haven't figured it out yet, can I have a code reference? |
My method is like this
In CellQueries.swift -> public extension Cell, i added a line of code,But I don’t know if it will cause any bugs |
Hi, may I ask how did you solve the problem? |
See the attached Package.swift, main.swift, and test.xlsx. The spreadsheet contains one worksheet with 3 rows and 3 columns. Yet when reading them Rows 1 and 3 show only 2 columns because ColumnB is empty. There should be 3 cells in each of the 3 rows.
If I am missing something in the documentation please let me know.
Thanks.
Archive.zip
The text was updated successfully, but these errors were encountered: