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

Not Finding Rels File #3554

Merged
merged 3 commits into from
May 11, 2023
Merged

Not Finding Rels File #3554

merged 3 commits into from
May 11, 2023

Conversation

oleibman
Copy link
Collaborator

@oleibman oleibman commented May 4, 2023

Fix #3553. Read of /xl/worksheets/_rels/sheet1.xml.rels fails on the new test worksheet (generated by 3rd party product), but read of xl/worksheets/_rels/sheet1.xml.rels (same name without leading slash) succeeds. Problem is that 3rd party product generates references with unexpected leading slash.

This is:

  • a bugfix
  • a new feature
  • refactoring
  • additional unit tests

Checklist:

  • Changes are covered by unit tests
    • Changes are covered by existing unit tests
    • New unit tests have been added
  • Code style is respected
  • Commit message explains why the change is made (see https://github.com/erlang/otp/wiki/Writing-good-commit-messages)
  • CHANGELOG.md contains a short summary of the change and a link to the pull request if applicable
  • Documentation is updated as necessary

Why this change is needed?

Provide an explanation of why this change is needed, with links to any Issues (if appropriate).
If this is a bugfix or a new feature, and there are no existing Issues, then please also create an issue that will make it easier to track progress with this PR.

Fix PHPOffice#3553. Read of `\xl\worksheets\_rels\sheet1.xml.rels` fails on the new test worksheet (generated by 3rd party product), but read of `xl\worksheets\_rels\sheet1.xml.rels` (same name without leading slash) succeeds. I'm not sure why (over 400 tests succeed with the slash), so will probably delay this a bit while I do more research.
@oleibman
Copy link
Collaborator Author

oleibman commented May 10, 2023

The problem in the original file is in _rels/.rels:

<?xml version="1.0" encoding="utf-8"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="/xl/workbook.xml" Id="rId2" />
<Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/meatadata/core-properties" Target="/docProps/core.xml" Id="rId4" />
<Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="/docProps/app.xml" Id="rId5" />
</Relationships>

The Target attributes all have leading slashes. In most (virtually all) Excel files, there is no leading slash. This suggests that the solution belongs where _rels/.rels is read. I will make that change. Unfortunately, for the file in question, there is nothing in core properties, and extended properties does not include any properties captured by PhpSpreadsheet, so the only thing we can test from this file remains the hyperlink.

@oleibman oleibman merged commit b3112e4 into PHPOffice:master May 11, 2023
@oleibman oleibman deleted the issue3553 branch June 9, 2023 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Error trying to load then save a particular Excel file generated by SQL Server Reporting Services
1 participant