Skip to content
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

Odd cell.s value #134

Closed
CMiller3 opened this issue Nov 28, 2020 · 5 comments · Fixed by #135
Closed

Odd cell.s value #134

CMiller3 opened this issue Nov 28, 2020 · 5 comments · Fixed by #135
Assignees

Comments

@CMiller3
Copy link

CMiller3 commented Nov 28, 2020

Version

0.13.0

Description of the bug

When querying a cell's "s" value, cell.s, defined in the documentation as

  // FIXME: Attribute "s" in a cell is an index into the styles table,
  // while the cell type "s" corresponds to the shared string table.
  // Can XMLCoder distinguish between an attribute and an
  // element having the same name?

Then querying the styles table as:

let styles = file.parseStyles() 
styles.cellStyles[Int(cell.s)]

//or 

styles.cellStyles?.items.first(where: {$0.builtinId == Int(cell.s ?? "") || $0.formatId == Int(cell.s ?? "")})

offers index out of range or nil in each respectively.

Expected behavior

I expected the cellsStyle table with index of cell.s to be the style sought.

@MaxDesiatov
Copy link
Collaborator

Thanks for creating this @CMiller3, would you kindly fill in the fields as specified in the description of the issue? Unfortunately, I won't be able to investigate it without this information.

@MaxDesiatov MaxDesiatov assigned CMiller3 and unassigned MaxDesiatov Nov 28, 2020
@MaxDesiatov MaxDesiatov added the more info needed Not enough details available to proceed label Nov 28, 2020
@CMiller3 CMiller3 removed their assignment Nov 28, 2020
@MaxDesiatov MaxDesiatov removed the more info needed Not enough details available to proceed label Nov 28, 2020
@MaxDesiatov MaxDesiatov self-assigned this Nov 28, 2020
@MaxDesiatov
Copy link
Collaborator

Thanks for updating the description, let me have a look...

@CMiller3
Copy link
Author

I could also be completely wrong -- just thought that was how the library worked. Thank you!

@CMiller3
Copy link
Author

Thank you for the attention -- it turns out the fields I was looking for were not in cellStyles but in cellFormats

styles.cellFormats?.items[Int(cell.s ?? "") ?? 100]

offered the clues of where to head next. I will say, intuitively I expected Formats to be more number format, not cell 'stylings' with colors and fonts.

@MaxDesiatov
Copy link
Collaborator

I agree with you, this is not a great name, but this is how the Microsoft folks have chosen to name it, unfortunately.

BTW, I've opened #135 to simplify lookups in formats and fonts, which will be included in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants