Free Support Forum - aspose.com

How to Export Nested Bookmarks in Output PDF using .NET | LINQ Reporting

Hello,

I have a word template containing 2 nested foreach lists.
I Added a bookmark tag in the template for each item of both sequences

<<foreach [x1 in source1]>>
<<bookmark [x1.Name] >>
   <<foreach [x2 in source2.Where(x=> x.FK == x1.Id) ]>>
   <<bookmark [x2.Name] >>
      content
   <</bookmark>>
   <</foreach>>
<</bookmark>>
<</foreach>>

My problem is Boomarks in the final PDF aren’t nested, all bookmark are at level 1.

I would like this kind of layout:
bookmark1
      bookmark1.1
      bookmark1.2
      bookmark1.3
bookmark2
      bookmark2.1
      bookmark2.2
      bookmark2.3

How could I have nested bookmarks by using bookmark tags and reporting engine?

Thanks

@bgamundi

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

bookmarks.zip (206.5 KB)
Hello,

Please find source code and files.

Regards

@bgamundi

Unfortunately, LINQ Reporting Engine does not provide the requested feature. However, we have logged this feature as WORDSNET-22123 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

@bgamundi

The issue you are facing is occurred because you do not specify bookmark outline levels when using LINQ Reporting Engine. Please use the attached modified template document and code example to get the desired output.

Docs and Code (Modified).zip (235.2 KB)

Thanks Tahir.

I tested, it seems to be OK until 3 nested levels.
However, it does’nt work from level 4. All outlines defined as level 4 are displayed in bookmark table as level 3. Could you check?
Thank you.

@bgamundi

We have not found the shared issue while using the same application. Please check the attached output PDF. 21.4.pdf (23.2 KB)

@tahir.manzoor

Please find my code and template:asposebook.zip (401.5 KB)

and the unexpected output: unexepected bookmark.png (2.6 KB)

Thank you

@bgamundi

You need to modify the template document according to your requirement. We have modified your template document and attached it with this post for your kind reference. test_bookmark_bg_modified.docx (14.1 KB)

The template syntax should be like:

<<foreach [x1 in source1]>>
<<bookmark [x1.Name] >><<[outlines.Add(x1.Name, x1.Level)]>> <</bookmark>>
 I am << [x1.Name] >>
        <<foreach [x2 in source2.Where(x=> x.Fk == x1.Id) ]>> 
<<bookmark [x2.Name] >><<[outlines.Add(x2.Name, x2.Level)]>> I am << [x2.Name] >><</bookmark>>   
      <<foreach [x3 in source3.Where(x=> x.Fk == x2.Id) ]>> 
<<bookmark [x3.Name] >><<[outlines.Add(x3.Name, x3.Level)]>> I am << [x3.Name] >> <</bookmark>>  
<<foreach [x4 in source4.Where(x=> x.Fk == x3.Id) ]>> 
<<bookmark [x4.Name] >><<[outlines.Add(x4.Name, x4.Level)]>> <</bookmark>>
I am << [x4.Name] >>   
     
    <</foreach>>
    <</foreach>>
    <</foreach>>
<</foreach>>