Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333335 - Table of contents PDF
Summary: Table of contents PDF
Status: VERIFIED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 2.6.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 4.4.1   Edit
Assignee: Yu Chen CLA
QA Contact: H N CLA
URL:
Whiteboard: Obsolete
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-30 07:37 EST by Peter CLA
Modified: 2014-09-16 18:51 EDT (History)
5 users (show)

See Also:


Attachments
Example report with empty Bookmarks. (29.54 KB, application/pdf)
2010-12-30 07:37 EST, Peter CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter CLA 2010-12-30 07:37:43 EST
Created attachment 185908 [details]
Example report with empty Bookmarks.

Hi, 

I'm using Birt to create pdf reports from data that already has sums and groupings therefore I do not want to use the grouping functionallity of Birt. 
But I want bookmarks in the pdf for every grouping level. I´ve tried to achieve this by adding a JavaScript to the DataItem of a table using this: 

data.addTOC("if (!BirtComp.compareString(row[\""+reportColumn.getName()+"\"],\"\")){\"\"+row[\""+reportColumn.getName()+"\"];};");

I hoped that this would generate a TOC-node for every row where reportColumn.getName() returns a value but it creates an empty TOC-node for rows with blank values, see the attaced file for an example.

What I want is that if the java script returns blank then no TOC-node will be created.

Or even better if it would be possible to create the TOC in an event handler at render runtime then you could create a TOC-node for a cell in a table based on its value.

I would very much appreciate if this could be solved.

Regards Peter
Comment 1 Xiaoying Gu CLA 2011-02-22 03:45:57 EST
Would you please attach your report design for me to investigate?
Comment 2 Peter CLA 2011-02-22 06:50:50 EST
(In reply to comment #1)
> Would you please attach your report design for me to investigate?

Finally I decided to rewrite my code and use grouping functionallity of Birt and get the Table of contents that way. 
I do not have a report design that you can use since I have rewritten the code that generates it.

What I would like to do is in an event handler check if the current row is a sum(from the other system) and if it is add a toc entry for it, e.g.

if ( sumrow ) {
   rowInstance.addTOCEntry(level, tocEntryText)
}

But since I have worked around this it is ok to close the bug (but I think it could be  useful to have this funtionallity in the future).

Kind regards Peter
Comment 3 Xiaoying Gu CLA 2011-02-22 22:23:29 EST
The TOC on data item of detail row can be set in the TOC expression builder in UI.
Comment 4 Peter CLA 2011-02-23 02:47:38 EST
(In reply to comment #3)
> The TOC on data item of detail row can be set in the TOC expression builder in
> UI.

Yes, this was what I tried to do (programmtically) as described above. I was trying to use a java script to return the string to be used as an toc-entry. The problem I had with this approach was that when the script did not return anything ( e.g. when a cell value was empty ) an empty toc-entry was created (in pdf).
If the java script does not return anything (or an empty String) I do not think that an toc-entry should be created.
Comment 5 Xiaoying Gu CLA 2011-02-23 03:00:39 EST
reopen
Comment 6 Zhiqiang Qian CLA 2014-07-28 18:08:02 EDT
Mark as fixed. see commit 5cf597718cdf1651eab6f6b0909050ab59d51025.
Comment 7 H N CLA 2014-09-16 18:20:06 EDT
UI to create expression for TOC item is available. Groups that does not have value are not shown in the TOC.

Verified in BIRT 4.4.1 build v20140909-0320.