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

conversion of xslx omitts empty cells at the beginning of a row #323

Closed
GVogeler opened this issue May 22, 2018 · 7 comments · Fixed by #587
Closed

conversion of xslx omitts empty cells at the beginning of a row #323

GVogeler opened this issue May 22, 2018 · 7 comments · Fixed by #587
Assignees
Labels
resp: StylesheetsGroup Issue is suitable for the group-learning approach taken in the Stylesheets Coop Working Group. status: needsDiscussion Council has not yet been able to agree on how to proceed. type: bug A bug report.

Comments

@GVogeler
Copy link

GVogeler commented May 22, 2018

The oxgarage conversion process (http://www.tei-c.org/oxgarage/#) from XLSX-spreadsheet to TEI P5 omitts empty cells leading a row:

emptycells.xlsx

where row[2] and row[3] start with an empyt cell.
Result is

<TEI xmlns="http://www.tei-c.org/ns/1.0"><teiHeader><fileDesc><titleStmt><title/><author>N.N.</author></titleStmt><publicationStmt><p>No publication statement</p></publicationStmt><sourceDesc><p>A TEI file automatically converted from a XSLX file.</p></sourceDesc></fileDesc></teiHeader><text><body>
<table><head>Table1</head>
  <row n="1"><cell>content1</cell><cell>Case1: online leading cells</cell></row>
  <row n="2"><cell>content2</cell><cell>case 2: leading cell empty</cell></row>
  <row n="3"><cell>content3</cell><cell/><cell>content4</cell><cell>case 3: leading cell empty, empty cell between content cells</cell></row>
</table>
</body></text></TEI>

where row[2] and row[3] start with content-cells from column B.

@GVogeler
Copy link
Author

GVogeler commented May 22, 2018

This occurs with more than one leading cell empty too.
Worksheet XML of the XLSX looks like the following:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
    xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac"
    xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">
    <dimension ref="A1:E4"/>
    <sheetViews>
        <sheetView tabSelected="1" workbookViewId="0">
            <selection activeCell="C5" sqref="C5"/>
        </sheetView>
    </sheetViews>
    <sheetFormatPr baseColWidth="10" defaultRowHeight="15" x14ac:dyDescent="0.25"/>
    <sheetData>
        <row r="1" spans="1:5" x14ac:dyDescent="0.25">
            <c r="A1" t="s">
                <v>0</v>
            </c>
            <c r="B1" t="s">
                <v>4</v>
            </c>
        </row>
        <row r="2" spans="1:5" x14ac:dyDescent="0.25">
            <c r="B2" t="s">
                <v>1</v>
            </c>
            <c r="C2" t="s">
                <v>7</v>
            </c>
        </row>
        <row r="3" spans="1:5" x14ac:dyDescent="0.25">
            <c r="B3" t="s">
                <v>2</v>
            </c>
            <c r="D3" t="s">
                <v>3</v>
            </c>
            <c r="E3" t="s">
                <v>5</v>
            </c>
        </row>
        <row r="4" spans="1:5" x14ac:dyDescent="0.25">
            <c r="C4" t="s">
                <v>6</v>
            </c>
            <c r="D4" t="s">
                <v>8</v>
            </c>
        </row>
    </sheetData>
    <pageMargins left="0.7" right="0.7" top="0.78740157499999996" bottom="0.78740157499999996"
        header="0.3" footer="0.3"/>
</worksheet>

@GVogeler
Copy link
Author

GVogeler commented May 22, 2018

suggestion to fix bug:

  1. add condition or position()=1 to https://github.com/TEIC/Stylesheets/blob/dev/xlsx/xlsxtotei.xsl#L158
  2. add to https://github.com/TEIC/Stylesheets/blob/dev/xlsx/xlsxtotei.xsl#L219 a switch for the last substraction (e.g. <xsl:variable name="corrector" select="if(position()=1) then (0) else (1)" as="xs:integer"/> and replace -1 with $corrector)

@martindholmes
Copy link
Contributor

I think you meant P5, not P4, right?

@GVogeler
Copy link
Author

GVogeler commented Jan 20, 2019

Of course, sorry! (See update text above)

@martindholmes martindholmes added the resp: StylesheetsGroup Issue is suitable for the group-learning approach taken in the Stylesheets Coop Working Group. label Apr 3, 2020
@peterstadler peterstadler added type: bug A bug report. status: needsDiscussion Council has not yet been able to agree on how to proceed. labels Jun 15, 2020
@peterstadler
Copy link
Member

@TEIC/tei-stylesheets-coop-group will need to have a look at this

@sydb
Copy link
Member

sydb commented Dec 1, 2022

I just tested, and (my interpretation of) @GVogeler’s fix seems to work perfectly, in that the test document he provides is (more) correctly converted to a TEI table with empty cells in the right place. No idea what other input table structures it might mess up, if any.
Not submitting a PR at the moment because neither make test nor make test2 run on my new system. As soon as I fix those …

@HelenaSabel HelenaSabel assigned HelenaSabel and sydb and unassigned HelenaSabel Dec 1, 2022
@sydb
Copy link
Member

sydb commented Dec 1, 2022

Note-to-self — If I can’t get ant fixed on my local machine in the next few days, submit PR anyway and @HelenaSabel will test it for me.

@peterstadler peterstadler linked a pull request Dec 2, 2022 that will close this issue
hcayless pushed a commit that referenced this issue Jan 26, 2023
* Impliment (my interpretation of) @GVogeler’s suggestion on ticket #323

* Change the changelog? Not I.

Co-authored-by: Helena Bermúdez Sabel <helena.b.sabel@gmail.com>
@martinascholger martinascholger added this to the Release 7.55.0 milestone Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resp: StylesheetsGroup Issue is suitable for the group-learning approach taken in the Stylesheets Coop Working Group. status: needsDiscussion Council has not yet been able to agree on how to proceed. type: bug A bug report.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants