[SOLVED] Reference to heading style in fields

Hi,



We need to insert a caption for figure therefore we use the following code:



builder.writeln();

builder.getParagraphFormat().setStyleIdentifier(StyleIdentifier.CAPTION);

builder.write(“Figure “);

Field f = builder.insertField(“STYLEREF “Heading 1” + " \s”);

builder.write(”-”);

builder.insertField(“SEQ " + “Figure” + " \* ARABIC \s 1”);

builder.write(title);



The problem is that when we open it in word, an update of the fields will fail depending on the language word uses, in french “Heading 1” becomes “Titre 1”.



In word we can reference the predefine heading style with a number, ie: 1 for “Heading 1”, 2 for “Heading 2” and so on.

So the corresponding field code for our need look likes:



STYLEREF 1 \s



We tried it and currently this is not supported by Aspose.



Is it possible to have a support for this ?

Hi Roseline,

Thanks for your inquiry. In case you are using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v13.1.0) from here and let us know how it goes on your side. If the problem still remains, please attach your input and output Word document here for testing. I will investigate the issue on my side and provide you more information.
PtiteRose:
In word we can reference the predefine heading style with a number, ie: 1 for "Heading 1", 2 for "Heading 2" and so on.
So the corresponding field code for our need look likes:
Yes, the UpdateFields does not update the value of a STYLEREF field with code like "{ STYLEREF 1 \s }". This issue has been resolved and the fix will be available in next version of Aspose.Words (v13.2.0) which is planned to be released by the end of this month (around February' 28, 2013).

We already uses the last version of Aspose.Words, our need was to use field code like this “{ STYLEREF 1 \s }”.



We are waiting for the new version.



Thanks for your answer.

Hi Roseline,


We will inform you via this forum thread as soon as the new release is published at the end of this month. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

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


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