Skip to content
This repository was archived by the owner on Jan 2, 2019. It is now read-only.
This repository was archived by the owner on Jan 2, 2019. It is now read-only.

SYLK Reader ignores formatting of rows and columns #776

Open
@KainederB

Description

@KainederB

Issue
The SYLK Reader does ignore certain formatting statements. If I were to format a column or row instead of individual cells, the formatting is not read. I convert a SLK file to XLSX, and all cells have the default formatting.
This is due to a wrong if clause in SYLK.php on line 411 and line 417

Example
E.g. a SLK file has a line containing:
F;P0;C1
that means Format Column 1 with format template 0

However in SYLK.php:411 the condition is as follows:
if (($formatStyle > '') && ($column > '') && ($row > '')) {

$column will be valid, but $row will be empty, hence the formatting is ignored.
When converting to an Excel file, the formatting will be missing. The original SLK file opens fine in Excel with the intended formatting.

Proposed fix
I changed the line to
if (($formatStyle > '') && (($column > '') || ($row > ''))) {
In that clause "incomplete" format statements will also be accepted. The test SLK file converts correctly. The issues is both in 1.8 and 1.9

Attachments
testdata.zip
convert_slk_to_xls.php - code used to convert the data
testdata.slk - original SYLK file
testdata1.xlsx - converted Excel file, formatting is missing (default)
testdata2.xlsx - after code change, correct Excel file

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions