Bug 66305

Summary: FILESAVE: ToC exported to XHTML still has page numbers
Product: LibreOffice Reporter: callow.mark
Component: WriterAssignee: Robert Antoni Buj i Gelonch <robert.buj>
Status: VERIFIED FIXED    
Severity: enhancement CC: buzea.bogdan, jmadero.dev, robinson.libreoffice
Priority: low Keywords: difficultyBeginner, easyHack, skillCpp
Version: 4.0.4.2 release   
Hardware: Other   
OS: All   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=65765
Whiteboard: target:5.0.0 target:7.0.0
Crash report or crash signature: Regression By:
Attachments: .odt containing ToC from large document

Description callow.mark 2013-06-28 08:20:47 UTC
When an auto-generated table of contents is exported to XHTML, the exported table of contents still has page numbers. There seems no point as the exported document is not paginated.

Also, in the original ToC the page numbers are right justified and separated from the section name by a row of periods. In the exported ToC, the page numbers are on the right but not justified. They are separated from the section names by about 4 spaces.

I suggest just not exporting the page numbers.
Comment 1 retired 2013-07-03 13:14:41 UTC
Mark: Could you please attach an example document and the exact steps on how to reproduce this problem? Otherwise it is very difficult to confirm this bug.

After attaching the requested information, please set this bug to UNCONFIRMED.

Thanks :)
Comment 2 callow.mark 2013-07-04 04:02:43 UTC
Created attachment 82003 [details]
.odt containing ToC from large document

Here is a .odt to reproduce the issue. It has only a ToC cut from a larger document whose source I cannot post in this public forum.

Export this document via File->Export, selecting xhtml as the output format. Observe that the exported HTML file still has page numbers on each ToC line, though without the "..." leading and right justification of the original.
Comment 3 retired 2014-01-16 18:53:39 UTC
Mark I tried reproducing this. Open your test file in 4.2.0.2, but when trying to "Save as..." I see no XHTML option, but only HTML.

So exporting to HTML keeps the page numbers. But since that might be intentional I'm adding NeedAdvice.

NEW since confirmed behavior.
Comment 4 retired 2014-01-16 19:12:51 UTC
Let's go with valid enhancement request.
Comment 5 callow.mark 2014-01-16 19:29:51 UTC
The XHTML option is in the dialog that appears after you select Export... from the File menu.

[Last time I tried Save As... HTML, the result had even more problems than the XHTML export so I stopped using it.]

Both Export... XHTML and Save As... HTML options export the document as a single long HTML page so page numbers make no sense and have no meaning or usefulness. This is a BUG not an enhancement request so I have changed it back.
Comment 6 Joel Madero 2014-01-16 20:28:21 UTC
@FOSS - NeedAdvice is only for UNCONFIRMED bugs, we just move to NEW if it's confirmed, then, if a dev ever looks at it, they can investigate. We should do as much of the heavy lifting as possible -- especially as here where it's an enhancement request. NeedAdvice pings our top devs to look into it, here that's probably not needed :)

Enhancement (behaves as intended, but valid request to change behaviour)
Low (probably not going to impact many people at all but a logical request and probably an easy hack)
Comment 7 Joel Madero 2014-02-27 22:55:21 UTC
In order to limit the confusion between ProposedEasyHack and EasyHack and to make queries much easier we are changing ProposedEasyHack to NeedsDevEval.

Thank you and apologies for the noise
Comment 8 Radu 2015-02-26 21:37:07 UTC
On LO Version: 4.2.7.2 page number is not exported anymore, but page number for each entry in TOC is not right aligned.
So Mark is still this a problem?
Comment 9 Commit Notification 2015-05-15 11:58:46 UTC
Robert Antoni Buj Gelonch committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1ab97fe7a244d091def863a1279e67394167144a

odf2xhtml: tdf#66305 do not display the page numbers in TOC

It will be available in 5.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 10 Yury 2015-05-21 11:18:05 UTC
If I understood this right, you do not exclude the TOC itself.
Why not retain page numbers, e.g. in XHTML comments, then?
Comment 11 Robert Antoni Buj i Gelonch 2015-05-21 11:47:51 UTC
TOC can have hyperlinks which are very useful, but page number in a continuous output isn't.
Comment 12 Robinson Tryon (qubit) 2015-12-15 23:37:15 UTC
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyBeginner SkillCpp)
[NinjaEdit]
Comment 13 Robinson Tryon (qubit) 2016-02-18 16:37:16 UTC
Remove LibreOffice Dev List from CC on EasyHacks
(curtailing excessive email to list)
[NinjaEdit]
Comment 14 Commit Notification 2020-04-16 13:44:46 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f2039cdbd827d60b8e0dbfa2e1d02dbb276514d6

tdf#66305: xhtml: Add unittest

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 BogdanB 2020-05-10 13:42:09 UTC
Nice job! Solved

Verified on
Version: 7.0.0.0.alpha1
Build ID: 6a03b2a54143a9bc0c6d4c7f1...
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3; 
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded