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
VarName = "MY VELOURIA"
DocumentBuilder.InsertField(" XE " & VarName & " \f ""b""", "")
The result is:
MY VELOURIA{ XE MY VELOURIA \f “b”|}
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!
Hi
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
VarName = "MY VELOURIA"
Dim start As Aspose.Words.FieldStart
start = builder.InsertField(" XE """ & VarName & """", "")
Dim sep As Aspose.Words.FieldSeparator = start.NextSibling.NextSibling
sep.Remove()
doc.Save("out.doc")
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;
sep.Remove();
doc.Save(@"223_96511_RichardJ\out.doc");
Hello!
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.
Regards,
Hi,
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.
Thanks,
-Aravinda
Hi
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.