We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Creating Index Field Entries

I'm trying to create an index using the DocumentBuilder.InsertField method. The field code that is created includes a "|" at the end that I can't get rid of it.

Here's an example of how I create the field:

Dim VarName as String


DocumentBuilder.InsertField(" XE " & VarName & " \f ""b""", "")

The result is:


or MY VELOURIA| when field codes are hidden.

Note the "|" at the end of the field. How do I get rid of this character? Besides displaying this character everything works fine.



Thanks for your request. I have reproduced this problem and logged it into our defect database as issue #3803. We will investigate whether and when it can be fixed. Please expect a reply before the next hotfix (within 2-3 weeks).

Also here is a workaround for you. You should remove a field separator and then all will work fine. See the following code.

Dim doc As Aspose.Words.Document = New Aspose.Words.Document()

Dim builder As Aspose.Words.DocumentBuilder = New Aspose.Words.DocumentBuilder(doc)

Dim VarName As String


Dim start As Aspose.Words.FieldStart

start = builder.InsertField(" XE """ & VarName & """", "")

Dim sep As Aspose.Words.FieldSeparator = start.NextSibling.NextSibling



And C# version.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

string VarName = "MY VELOURIA";

FieldStart start = builder.InsertField(" XE \"" + VarName + "\"", "");

FieldSeparator sep = (FieldSeparator)start.NextSibling.NextSibling;



I hope that it will help you.

Best regards.

We have released a new version of Aspose.Words that contains a fix for your issue.

The new version of Aspose.Words is available for download from here.

Best regards.


Is it possible to add multiple Indexes for a word document. See Attachment for reference. I am looking for some syntaxt in VB .NET

Hello!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your inquiry.

I think you can only simulate this manually. Please tell us why you need several indexes. This approach is uncommon.



Please refer to attached document. Each of main entry represents an index. It looks like a content page. But the document has a separate content page. Also, I am unable make Index and content to appear simultaneously.

I appreciate any help in this regard.



Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Unfortunately I can’t find any way to achieve this using MS Words so you can’t also achieve this using Aspose.Words.

You can have multiple indexes in the document but all indexes will refer to the same entries.

You can try to achieve what you need in the word document and attach the document there. Then we will investigate the document and try to help you.

Best regards.

Hi Alexely,

I’m using latest version and not able to rid of ‘XE’ in TOC and its not updating properly.

Please find below code.

//Section heading Styles
strHeading = rFQSectionHeading.RFQSectionHeadingDesc;
dbuilder.InsertField(" XE “” + strHeading + “”", “”);
dbuilder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;

//Sub Heading Styles
strSubHeading = rFQSubHeading.RFQSubHeadingDesc;
dbuilder.InsertField(" XE “” + strSubHeading + “”", “”);
dbuilder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;
strSubHeading = ReplaceReferenceText(strSubHeading, evt);


Please let me know…Is there anything I need to add in the code to rid of ‘XE’.
Why TOC is not updating automatically ?

I need to start TOC should be from third page. Is it possible?



Thanks for your request. I think, in your case, you should use TC fields. Please see the following code:

//Create document

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

//Insert TOC

builder.InsertTableOfContents(@"\f \h \z");


// Insert few TC fields.

builder.InsertField("TC \"item1\" \\l 1");

builder.InsertField("TC \"item2\" \\l 1");

builder.InsertField("TC \"item3\" \\l 1");

builder.InsertField("TC \"item4\" \\l 1");

builder.InsertField("TC \"item5\" \\l 1");

builder.InsertField("TC \"item6\" \\l 1");

// Update fields.


// Save output


Hope this helps.

Best regards,

The issues you have found earlier (filed as WORDSNET-3583) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.