Hide items from the TOC

Hello, 

I am using the following code to create numbered tables: 

 var tableNumberField = paragraph.AppendField("Table", FieldType.FieldSequence) as WSeqField;

 tableNumberField.HideResult = true;

 paragraph.AppendText(reportTable.Title).ApplyCharacterFormat(format);

paragraph.ParagraphFormat.KeepFollow = true;


And using the following to create a table of tables: 

 var tablesTocParagraph = tocSection.AddParagraph();

 tablesTocParagraph.AppendText("List of Tables");


 //Create a new paragraph and append TOC.

 tablesTocParagraph = tocSection.AddParagraph();

 var tablesTOC = tablesTocParagraph.AppendTOC(1, 3);


 //Disable a flag to exclude heading style paragraphs in TOC entries.

 tablesTOC.UseHeadingStyles = false;

 //Set the name of SEQ field identifier for table of tables.

 tablesTOC.TableOfFiguresLabel = "Table";


I would like to exclude certain tables from the Table of Tables. Can you show me how to do that please? 

Thanks. 


5 Replies

SR Sindhu Ramesh Syncfusion Team January 23, 2025 10:25 AM UTC

Natalie,
We have prepared a sample to hide the sequence field and update the TOC. Upon testing, we noticed that while the sequence number is hidden, the TOC entry remains visible.
We were able to reproduce the reported issue, “TOC remains visible after hiding the Sequence Field” on our end. We will validate this issue and provide you with more details within 2 days. Once the bug is fixed, you can use this solution.

Regards,
Sindhu Ramesh.



Attachment: HideItemsinTOC_4d848858.zip


SR Sindhu Ramesh Syncfusion Team January 27, 2025 04:47 PM UTC

Natalie,
We have confirmed that the reported issue with "Table of Figures is not updated properly after calling UpdateTableOfContents API” is a defect and we have logged a defect report. We will include the fix for this defect in our weekly NuGet release, which is estimated to be available on second week of February.

The status of this bug can be tracked through the below link: 
feedback link

Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.

Regards,
Sindhu Ramesh.



SR Sindhu Ramesh Syncfusion Team February 11, 2025 11:31 AM UTC

Natalie,
As promised earlier, we have included the fix for the reported issue with “Table of Figures is not updated properly after calling UpdateTableOfContents API" in our latest weekly NuGet release (v28.2.5).

Root cause of the issue:
Failing to check if the sequence field is hidden result is hidden causing the issue.

Please use the below link to download our latest weekly NuGet:
Syncfusion.DocIO.Wpf

The status of this bug can be tracked through the below link:
Table of Figures is not updated properly after calling UpdateTableOfContents API in WPF | Feedback Portal

Note: We will include this fix in our 2025 Volume 1 Main release, which will be available at the end of March 2025.



NW Natalie Westphal April 3, 2025 09:10 PM UTC

Hello,

In the attached sample project, I would like for there to be an entry in the List of Tables for the Product Details table, but I would like to hide the word "Table" from both the table title and in the list of tables. The attached word document shows what I would like to achieve. Is this possible?  


Attachment: Output_654dd0aa.zip


SR Sindhu Ramesh Syncfusion Team April 4, 2025 03:30 PM UTC

Natalie,
From the expected output document you provided, we understand that your requirement is to display both a table entry with a sequence field identifier (e.g., “1 Employee Details”) and another entry (e.g., “Product Details”) in the List of Tables (TOC).

To achieve this, we have created a TOC that includes both a sequence field and a paragraph styled with a custom style named “MyStyle”. Applied the custom style “MyStyle” to the paragraph containing “Product Details”.

In this way, the TOC will include both entries as expected. Kindly refer to the attached sample for implementation details along with output document.


Attachment: HideItemsinTOC_(2)_f62e0a55.zip

Loader.
Up arrow icon