function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vipulpahwavipulpahwa 

Table of Contents in Visualforce

Requirement: To create a professional looking dynamic pdf with Headers, Footers Table of Contents, etc. The page needs to be dynamic enough to display multiple sets of records, classified into categories (Won Opportunities, Lost Opportunities, Active Opportunities etc. in a tabular format spanning multiple pages due to the number of records.). 

 

What I have managed so far is that using this I have managed to insert repeating Headers and Footers and using the css page-break-before property I have managed to insert page breaks where appropriate.

 

Where I am struggling is to generate a dynamic Table of Contents with indented headers (hyperlinks) and page numbers.

 

Has anyone come across such requirement? Any help will be much appreciated.

 

Cheers

Vipul

vipulpahwavipulpahwa

Has nobody come across such a requirement?

Itsnag8Itsnag8

were u able to figure it out ?

vipulpahwavipulpahwa
Unfortunately no. haven't yet got an answer to this
Chris Tufts 3Chris Tufts 3
Hi V,

I just managed to get this to work in a bit more of a complicated example, so adding my code wouldn't help much as its hard to see the forest through the trees... but i thnk if I give you the general idea you should be able to follow along...
  • put all your content into a wrapper class (if you aren't already)
  • add a public integer for 'anchor reference' to your wrapper class
  • when you instantiate the wrapper class bump this int with a counter (i looped through the list of my wrapper class after it was sorter, for lack of a better place to do it, but you should be able to do it in the instantiation loop as well)
  • in the VF page have a 'table of contents' apex:repeat or apex:pageblocktable that has an outputlink with the value of "#{!repeatVariable.anchorReference}"
  • then a scondary apex:repeat or apex:pageblocktable for your data and in an appropriate place add <a name="{!repeatVariable.anchorReference}"
the output link at that point should jump down to the page anchor


hope that helps, I can probably help if you add your code here so i could show you what i mean
Maximilien DRIGEARD DESGARNIERMaximilien DRIGEARD DESGARNIER

Hi,

I'm looking for a similar problem.
I have my page with 2 loops.
The first generates letters.
the second is the table of contents and one counter.

I would like know if a letter is on 2 pages or more.
For it, i think to compare my counter in the second loop with the number of the page.
But i don't know how know the number of the page.

I think use a table with number of page for compare my counter and counter.table.
But my problem is to know how get the number of the page.

3 days i'm searching and nothing...
If someone can help me...

TY very much
and sorry for my english