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

ODT writer drops row headings #8764

Closed
larsgw opened this issue Apr 7, 2023 · 0 comments
Closed

ODT writer drops row headings #8764

larsgw opened this issue Apr 7, 2023 · 0 comments
Labels

Comments

@larsgw
Copy link

larsgw commented Apr 7, 2023

Explain the problem.

The ODT writer seems to drop row headings. The example here uses HTML input but I could also reproduce it with a custom reader and the row_head_columns option.

pandoc -f html -t odt odt-table-header.html > odt-table-header.odt

odt-table-header.html:

<table>
  <tbody>
    <tr>
      <th>Header</th>
      <td>Normal cell (column 2)</td>
      <td>Normal cell (column 3)</td>
    </tr>
    <tr>
      <td>Normal cell (column 1)</td>
      <td>Normal cell (column 2)</td>
      <td>Normal cell (column 3)</td>
    </tr>
  </tbody>
</table>

Not only does is the output missing the header cell, the entire column is skipped, and an empty column is appended at the end. Relevant part of odt-table-header.odt:

<table:table table:name="Table1" table:style-name="Table1">
	<table:table-column table:style-name="Table1.A"/>
	<table:table-column table:style-name="Table1.B"/>
	<table:table-column table:style-name="Table1.C"/>
	<table:table-row>
		<table:table-cell table:style-name="TableRowCell" office:value-type="string">
			<text:p text:style-name="Table_20_Contents">Normal cell (column 2)</text:p>
		</table:table-cell>
		<table:table-cell table:style-name="TableRowCell" office:value-type="string">
			<text:p text:style-name="Table_20_Contents">Normal cell (column 3)</text:p>
		</table:table-cell>
	</table:table-row>
	<table:table-row>
		<table:table-cell table:style-name="TableRowCell" office:value-type="string">
			<text:p text:style-name="Table_20_Contents">Normal cell (column 2)</text:p>
		</table:table-cell>
		<table:table-cell table:style-name="TableRowCell" office:value-type="string">
			<text:p text:style-name="Table_20_Contents">Normal cell (column 3)</text:p>
		</table:table-cell>
	</table:table-row>
</table:table>

Pandoc version?

$ pandoc --version
pandoc 3.1.2
Features: +server +lua
Scripting engine: Lua 5.4
$ uname -v
#1 SMP PREEMPT_DYNAMIC Debian 6.0.12-1~bpo11+1 (2022-12-19)
@larsgw larsgw added the bug label Apr 7, 2023
mistmist added a commit to mistmist/pandoc that referenced this issue May 1, 2023
While ODF 1.3 part 3 does specify a 9.1.11 <table:table-header-columns>
element, in practice it's only implemented by spreadsheet applications,
not word processors.

So simply treat the row header columns as ordinary table columns, at
least they don't get lost then.

Fixes: jgm#8764
mistmist added a commit to mistmist/pandoc that referenced this issue May 1, 2023
The previous commit prevented header column cells from being dropped on
the floor, this one changes the paragraph style to "Table_20_Heading".

Note that for the test input, the result is not correct: the
AnnotatedTable type cannot represent the HTML input properly, as it only
has a concept of header rows and header columns, but HTML can have an
individual cell that is a header (not 100% sure but they way i read
https://html.spec.whatwg.org/#header-and-data-cell-semantics the <th>
cell here is both a row header cell and a column header cell while the
other cells in the row and column are not header cells), and header
cells may even appear "in the middle" of a table (see example in
https://html.spec.whatwg.org/#the-th-element).

So while this appears like it's the right thing to do for
Writer.OpenDocument, it's not clear if this is going to make things
better or worse overall.

Fixes: jgm#8764
@jgm jgm closed this as completed in 2881c12 May 2, 2023
jgm pushed a commit that referenced this issue May 2, 2023
The previous commit prevented header column cells from being dropped on
the floor, this one changes the paragraph style to "Table_20_Heading".

Note that for the test input, the result is not correct: the
AnnotatedTable type cannot represent the HTML input properly, as it only
has a concept of header rows and header columns, but HTML can have an
individual cell that is a header (not 100% sure but they way i read
https://html.spec.whatwg.org/#header-and-data-cell-semantics the <th>
cell here is both a row header cell and a column header cell while the
other cells in the row and column are not header cells), and header
cells may even appear "in the middle" of a table (see example in
https://html.spec.whatwg.org/#the-th-element).

So while this appears like it's the right thing to do for
Writer.OpenDocument, it's not clear if this is going to make things
better or worse overall.

Fixes: #8764
jgm added a commit that referenced this issue Aug 5, 2023
jgm added a commit that referenced this issue Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant