Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Aug 30, 2019 8:12 am

Hi,

I have a problem when i add a toc to my document. I need to update the field and then change the police of special characters like "ç" or "é" to have a correct one. I'm only using "AppendTOC(int x,int y)"

thbryer
 
Posts: 10
Joined: Wed Apr 24, 2019 6:33 am

Fri Aug 30, 2019 9:45 am

Hi,

Thanks for your inquiry.
Please try the code below to update the TOC first.

Code: Select all
            //update the TOC
            doc.UpdateTableOfContents();


If the issue still exists, to help us investigate your issue accurately, please offer us your input Word file and the complete code you were using.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Fri Aug 30, 2019 12:36 pm

I also used UpdateTableOfContents()
This is my code, i let you my starting Word document. (same issue when i create a document, it was just faster to send you it like this)
Code: Select all
        static void Main(string[] args)
        {
            string docWord = @"C:\Users\thb\Desktop\testTOC.docx";                             // TO MODIFY
            SPI.Document doc = new SPI.Document();
            doc.LoadFromFile(docWord);
            SPI.Section section = doc.AddSection();
            SPI.Documents.Paragraph para = section.AddParagraph();
            para.AppendTOC(1, 3);
            doc.UpdateTableOfContents();
            doc.SaveToFile(@"C:\Users\thb\Desktop\testTOCModified.docx");                      // TO MODIFY
        }

thbryer
 
Posts: 10
Joined: Wed Apr 24, 2019 6:33 am

Mon Sep 02, 2019 10:06 am

Hi,

Thanks for your information and sorry to reply late for weekend.
After investigation, I found the font of the characters "Ç" and "é" in added TOC is “Times New Roman" while other characters is "Arial". The size is not same between two fonts.
You could change the font of paragraphs to “Arial". Below is the code for your reference.

Code: Select all
            ParagraphStyle style = new ParagraphStyle(doc);
            style.Name = "MyStyle";
            style.CharacterFormat.FontName = "Arial";
            doc.Styles.Add(style);
            for (int i = 0; i < section.Paragraphs.Count; i++)
            {
                section.Paragraphs[i].ApplyStyle("MyStyle");
            }


Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Wed Oct 30, 2019 3:12 am

Hi,

Greetings from E-iceblue.
Have you tried the code I offered you last time? Does it solve your issue?
Could you please give us some feedback at your convenience?

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Mon Feb 17, 2020 9:40 am

Hi, i'm the new developer in charge of this project. I resolve the issue of the special character but the issue with the format of the table of contents is not resolved, I need to manually refresh my table of contents in order to have a correctly formatted one (tabulation).

asterakin
 
Posts: 9
Joined: Mon Apr 15, 2019 7:50 am

Mon Feb 17, 2020 11:04 am

Hello,

Thanks for your post.
We will do further investigation on your issue and then give you a feedback asap.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Tue Feb 18, 2020 7:11 am

Hello,

I indeed noticed that the TOC tabs of the generated file are incorrect. This issue has been logged into our bug tracking system with the ticket SPIREDOC-3924. We will let you know if there is any update.
Apologize for the inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri Jul 10, 2020 1:22 pm

Is there any news related to my problem ?

asterakin
 
Posts: 9
Joined: Mon Apr 15, 2019 7:50 am

Mon Jul 13, 2020 9:09 am

Hello,

Thanks for your following up.
Sorry to tell you that our Dev team is still fixing this issue due to its complexity. I have urged them to speed up the fix. Anyway, we have given your issue a high priority, we will inform you as soon as there is any update.
Apologize for the delay and inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.Doc