Issue 52214 - Exporting simple table to xhtml outputs only first column
Summary: Exporting simple table to xhtml outputs only first column
Status: ACCEPTED
Alias: None
Product: Calc
Classification: Application
Component: save-export (show other issues)
Version: OOo 2.0
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-20 10:13 UTC by cfgardiner
Modified: 2013-08-07 15:12 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
spreadsheet file causing problem (6.45 KB, application/vnd.oasis.opendocument.spreadsheet)
2005-07-20 15:14 UTC, cfgardiner
no flags Details
xhtml output from prev. posting (2.63 KB, text/html)
2005-07-20 15:15 UTC, cfgardiner
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description cfgardiner 2005-07-20 10:13:30 UTC
Hi,

It would seem that exporting a simple table to XHTML (from the spreadsheet app)
only writes the first column to the XHTML file. Remaining columns are ignored.

NOTE: The error only occurs if the first row is formatted as a heading (using
F11 etc.)

Test case used a simple 9 (rows) x 4 (cols) array of numbers but was intitially
detected while trying to export a larger table of strings.

Issue has so far only been tried on linux (SuSE 9.3)

Regards,
Charles
Comment 1 frank 2005-07-20 11:15:26 UTC
Could not reproduce using m118 build.

Also the Prio was much to high.

Frank
Comment 2 frank 2005-07-20 11:17:01 UTC
closed wfm
Comment 3 cfgardiner 2005-07-20 15:12:13 UTC
I beg to differ.

I have just installed 1.9.118 on my system and consistently get the originally
reported behaviour. NOTE: export to xhtml is ok if all cells are of
template-type standard. Error only occurs if first row is changed to
template-type 'heading'

If I can find the link, I'll upload the odt and xhtml as a follow up.

System:
Linux charles 2.6.11.4-21.7-default #1 Thu Jun 2 14:23:14 UTC 2005 i686 i686
i386 GNU/Linux (SuSE Linux 9.3)

Regards,
Charles
Comment 4 cfgardiner 2005-07-20 15:14:31 UTC
Created attachment 28085 [details]
spreadsheet file causing problem
Comment 5 cfgardiner 2005-07-20 15:15:35 UTC
Created attachment 28086 [details]
xhtml output from prev. posting
Comment 6 frank 2005-07-20 15:34:09 UTC
Hi Swante,

have a look at this one please.

Frank
Comment 7 svante.schubert 2005-08-08 13:36:05 UTC
OCCURANCE:
I can reproduce the issue, when I change the style for a complete row or table.
By doing this only one table:table-column exists (in the content.xml), which is
repeated 256 times.

BACKGROUND:
This issue comes from a workaround for XHTML, when too many repeated cells are
involved
For instance some Calc documents simulate a background by repeating empty cells
with a certain style.. 
But this would result into very large XHTML writing out too many emty cells as
there is no repeated attribute.
In total 256 * 65536 = 16 777 216 cells might be written, creating several
megabytes of XHTML, which is in general undesired by the user.

XSLT FIX:
The easiest fix for this issue is the exchange of two conditions in
common/table/table_cells.xsl

Changing

test="$currentTableColumn[not(@table:visibility = 'collapse' or
@table:visibility = 'filter')]">

to

test="not($currentTableColumn[@table:visibility = 'collapse' or
@table:visibility = 'filter'])">

In the latter case the variable currentTableColumn doesn't have to exist to
return true.
Comment 8 svante.schubert 2005-08-08 14:23:59 UTC
Even repeated cells would work - repeated (empty) cells would be created, when
adding content the end of the row, but skipping some (repeated empty) cells.

Unfortunately the width (added by the column / colgroup) get lost.
Even the similar repeated colums could be exchange to one columngroup (cmp.
http://de.selfhtml.org/html/tabellen/aufbau.htm#vordefinieren)
A valid expression as
<colgroup class="co1" />
would not be recognized in the Mozilla Firefox 1.04 (Windows)

Nevertheless it should be worth to be added in export\xhtml\table.xsl, so future
browser might show it correct by exchanging the existing <xsl:element
name="colgroup"> to:

<xsl:element name="colgroup">
    <xsl:choose>
        <xsl:when test="count(table:table-column) = 1">
            <xsl:if test="not(table:table-column/@table:visibility = 'collapse'
or table:table-column/@table:visibility = 'filter')">                
                <xsl:attribute name="class"><xsl:value-of
select="table:table-column/@table:style-name"/></xsl:attribute>
            </xsl:if>
        </xsl:when>
        <xsl:otherwise>
            <xsl:for-each select="$allTableColumns/table:table-column">
                <xsl:if test="not(@table:visibility = 'collapse' or
@table:visibility = 'filter')">
                    <xsl:element name="col">
                        <xsl:variable name="value"
select="$globalData/all-ooo-styles/style[@style:name =
current()/@table:style-name]/*/@style:column-width" />
                        <xsl:if test="$value">
                            <xsl:attribute name="width">
                                <!-- using the absolute width, problems with the
relative in browser (in OOo style:rel-column-width) -->
                                <xsl:call-template name="convert2px">
                                    <xsl:with-param name="value"
select="$globalData/all-ooo-styles/style[@style:name =
current()/@table:style-name]/*/@style:column-width" />
                                </xsl:call-template>
                            </xsl:attribute>
                        </xsl:if>
                    </xsl:element>
                </xsl:if>
            </xsl:for-each>
        </xsl:otherwise>
    </xsl:choose>
</xsl:element>	
Comment 9 svante.schubert 2005-08-08 15:05:50 UTC
The final add on for this fix - to keep the width attribute of the neglected
repeated column in the cells - would be in xhtml\table.xsl
exchanging the style creation beyond <!-- set column style (disjunct of cell
style) -->

<!-- set column style (disjunct of cell style) -->
<xsl:choose>                
    <xsl:when test="normalize-space($currentTableColumn) != ''">                
        <xsl:value-of select="$globalData/all-styles/style[@style:name =
$currentTableColumn/@table:style-name]/final-properties" />
    </xsl:when>                                
    <xsl:otherwise>
    <xsl:variable name="columnStyleName"
select="ancestor::table:table/table:table-column/@table:style-name" />
        <!-- no currentTableColumn means there is only one column repeated till
the end -->
        <xsl:value-of select="$globalData/all-styles/style[@style:name =
$columnStyleName]/final-properties" />                                        
    </xsl:otherwise>
</xsl:choose>