Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Sat Apr 04, 2020 2:44 pm

Hi,

I need to add the following field:

{ ADVANCE \l 8}

I use:

Code: Select all
Field field = paragraph.AppendField("\\l 8", FieldType.FieldAdvance);


however Spire.Doc adds the following field instead:

{ ADVANCE "\l 8"}

and it does not work because of the double quotes. I need to enter the field without double quotes. How can I do that?
Thanks!

visualboy
 
Posts: 5
Joined: Fri Apr 03, 2020 3:30 pm

Mon Apr 06, 2020 7:32 am

Hi,

Thanks for your post.
I used the line,Field field = paragraph.AppendField("\\l 8", FieldType.FieldAdvance), and indeed reproduced the double quotes issue. I have logged it into our bug tracking system with the ticket SPIREDOC-4161. Sorry for the inconvenience caused. We will inform you when it is fixed.
Please use the following method for the time being.
Code: Select all
   Document doc = new Document();
            Section section = doc.AddSection();
            Paragraph paragraph = section.AddParagraph();
         
            int index = 0;
            FieldMark mark = new FieldMark(doc, FieldMarkType.FieldSeparator);
            Field field = new Field(doc);
            field.Type = FieldType.FieldAdvance;
            field.Code = @" ADVANCE  \l 8 ";
            paragraph.ChildObjects.Insert(index, field);
            IParagraphBase end = doc.CreateParagraphItem(ParagraphItemType.FieldMark);
            (end as FieldMark).Type = FieldMarkType.FieldEnd;
            paragraph.ChildObjects.Insert(1, end);
            field.End = end as FieldMark;

            doc.IsUpdateFields = true;
            string result = "result1.docx";
            doc.SaveToFile(result, FileFormat.Docx2013);


Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2406
Joined: Wed Jun 27, 2012 8:50 am

Wed Apr 29, 2020 9:53 am

Hi,

Glad to inform you that SPIREDOC-4161 has been fixed, welcome to download new version Spire.Doc Pack(hot fix) Version:8.4.10 from the following link.
Website link: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget link: https://www.nuget.org/packages/Spire.Doc/8.4.10

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2406
Joined: Wed Jun 27, 2012 8:50 am

Wed May 20, 2020 10:22 am

Hi,

Hope you are doing well.
Did Spire.Doc Pack(hot fix) Version:8.4.10 resolve your issue?
Looking forward to your feedback.

Sincerely
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2406
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc