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

Failure to open project XLSX in MSFT Excel on Windows #206

Closed
pombredanne opened this issue Jun 18, 2021 · 3 comments
Closed

Failure to open project XLSX in MSFT Excel on Windows #206

pombredanne opened this issue Jun 18, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@pombredanne
Copy link
Contributor

I scan OK https://files.pythonhosted.org/packages/94/40/c396b5b212533716949a4d295f91a4c100d51ba95ea9e2d96b6b0517e5a5/urllib3-1.26.5.tar.gz with the scan_codebase pipeline.
I then fetch the project XLSX and open it in a VM on Windows with MSFT Office and I get a message that the document is corrupted.
It is because the package description exceeds 32767 characters length which is a limit in Excel.
XlsxWriter should truncate these but does not here.
We should also report an error in anycase rather than truncate silently.

@pombredanne pombredanne added the bug Something isn't working label Jun 18, 2021
pombredanne added a commit that referenced this issue Jun 18, 2021
We now check that the content is correctly added before calling
XlsxWriter and report and error if the truncated can be truncated.
Several other adaptations of a cell content are done:

 - Create a combined license expression for expressions.
 - Keep only unique values in lists, preserving ordering.
 - Collect the main attribute of well known scan fields
 - Convert mappings to YAML.
 - Truncate the "description" field to the first five lines.
 - Convert anything unknown to string.
 - Normalize line endings
 - Truncate to a maximum_length any field too long to fit in an XLSX
   cell and report error.

Signed-off-by: Philippe Ombredanne <[email protected]>
@pombredanne
Copy link
Contributor Author

There is a bug in XlsxWriter tracked here: jmcnamara/XlsxWriter#812

tdruez added a commit that referenced this issue Jun 22, 2021
tdruez added a commit that referenced this issue Jun 22, 2021
tdruez added a commit that referenced this issue Jun 22, 2021
Signed-off-by: Thomas Druez <[email protected]>
tdruez added a commit that referenced this issue Jun 22, 2021
Signed-off-by: Thomas Druez <[email protected]>
tdruez added a commit that referenced this issue Jun 22, 2021
* Improve XLSX creation #206

We now check that the content is correctly added before calling
XlsxWriter and report and error if the truncated can be truncated.
Several other adaptations of a cell content are done:

 - Create a combined license expression for expressions.
 - Keep only unique values in lists, preserving ordering.
 - Collect the main attribute of well known scan fields
 - Convert mappings to YAML.
 - Truncate the "description" field to the first five lines.
 - Convert anything unknown to string.
 - Normalize line endings
 - Truncate to a maximum_length any field too long to fit in an XLSX
   cell and report error.

Signed-off-by: Philippe Ombredanne <[email protected]>

* Format code

Signed-off-by: Philippe Ombredanne <[email protected]>

* Set row height to avoid auto-fit and improve the workbook labels #206

Signed-off-by: Thomas Druez <[email protected]>

* Minor code improvements to the errors col setup #206

Signed-off-by: Thomas Druez <[email protected]>

* Add changelog entry #206

Signed-off-by: Thomas Druez <[email protected]>

* Remove print statements #206

Signed-off-by: Thomas Druez <[email protected]>

Co-authored-by: Thomas Druez <[email protected]>
@tdruez
Copy link
Contributor

tdruez commented Jul 23, 2021

@pombredanne This one is fixed, right?

@tdruez
Copy link
Contributor

tdruez commented Aug 2, 2021

Fixed confirmed.

@tdruez tdruez closed this as completed Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants