Tc field problem

Hi, I am trying to reproduce TC field with following simple code:

Document document = new Document();
DocumentBuilder builder = new DocumentBuilder(document);
FieldStart start = builder.insertField("TC", "text");
document.save("D:/out.doc");

In attachment there are two pictures of fields, one is of field that I want to achieve and the other is field that I am getting in word. Also when I want to open out.doc in DocumentExplorer I get exception:
java.lang.ClassCastException: com.aspose.words.FieldSeparator cannot be cast to com.aspose.words.FieldStart.
I am using aspose.words for java.
Thanks, Ivica.

Hi
Thanks for your inquiry. I think that you should use the following code snippet.

builder.insertField("TC \"test\"", null);

I think this could help you.
Best regards.

Yes that helped, can you tell is there any general rule for creating fields (I need to create various types of fields independently of their values), and if you can tell me why is second argument null (is it because there is no field separator maybe).
Thanks, Ivica.

Hello Ivica!
There are no general rules just because everything is very straightforward: the first argument is field code that contains field type and all possible switches for it; the second one is value. How to form field codes for miscellaneous fields you can spy in MS Word or probably find on the Internet. At last you can ask support if this comes difficult.
The second parameter is null just because this field shouldn’t have initial value.
Regards,

Ok, thanks.