Update Bibliography field

Hello everyone, I added a bibliography to a word file using the customXmlPart. The bibliography is added well but only when I enter the document and press the F9 key. Isn’t there a way to display it without this step, directly in the document.

@lafydo Could you please upload your document with bibliography here to reproduce the task? We will provide you more information.

@lafydo As I already mentioned in other your thread, Updating bibliography fields is not yet supported by Aspose.Words. This feature request is logged as WORDSNET-13854 in our defect tracking system. We will keep you informed and let you know once it is supported.

Test.docx (13.5 KB)

Here you have the file with an example.

I use this code :

CustomXmlPart xmlPart = document.CustomXmlParts.Add("Sources",
                        "<b:Sources xmlns:b =\"http://schemas.openxmlformats.org/officeDocument/2006/bibliography\" xmlns = \"http://schemas.openxmlformats.org/officeDocument/2006/bibliography\" SelectedStyle = \"\\APASixthEditionOfficeOnline.xsl\" StyleName = \"APA\" Version = \"6\">" +
                            "<b:Source>" +
                                "<b:Tag>Jul99 </b:Tag>" +
                                "<b:SourceType>Book</b:SourceType>" +
                                 "<b:Guid>{ 5D70EC2B - 7CA3 - 4969 - 8269 - 2C7C66DA05CD}</b:Guid>" +
                                 "<b:Author><b:Author>" +
                                 "<b:NameList>" +
                                    "<b:Person>" +
                                        "<b:Last>Julien</b:Last>" +
                                    "</b:Person>" +
                                 "</b:NameList>" +
                                 "</b:Author></b:Author>" +
                                 "<b:Title>MyTitle</b:Title>" +
                                 "<b:Year>1999 </b:Year>" +
                                 "<b:City>Alfortville</b:City>" +
                                 "<b:Publisher>Me</b:Publisher>" +
                                 "<b:RefOrder>1</b:RefOrder>" +
                             "</b:Source>" +
                        "</b:Sources> ");

And to insert the bibliography we use :

FieldBibliography fieldBibli = (FieldBibliography)builder.InsertField(FieldType.FieldBibliography, false);

And the problem is that if I want to display the bibliography field I have to open the doc and press F9. If this is possible I want to open the doc with the bibliography already display. Thank for your help !

Yes I saw your answer and thanksa lot for your help. I have an other question for you : How to put this field at the end of the doc. I used :


And doesn’t work.


The following code inserts the filed at the end of the document:

FieldBibliography fieldBibli = (FieldBibliography)builder.InsertField(FieldType.FieldBibliography, false);

The field is inserted in the last paragraph of the document as expected.

To display the value of Bibliography it is required to update this field. But unfortunately, currently Aspose.Words does not support updating this type of fields. As a temporary workaround, you can set the display result of Bibliography field in the code:

fieldBibli.Result = "This is my bibliography field";

The issues you have found earlier (filed as WORDSNET-13854) have been fixed in this Aspose.Words for .NET 23.8 update also available on NuGet.