FieldCitationPageNumber Property

Gets or sets a page number associated with the citation.

Namespace:  Aspose.Words.Fields
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public string PageNumber { get; set; }

Property Value

Type: String
Examples
Shows how to work with CITATION and BIBLIOGRAPHY fields.
// Open a document that has bibliographical sources
Document doc = new Document(MyDir + "Bibliography.docx");

// Add text that we can cite
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("Text to be cited with one source.");

// Create a citation field using the document builder
FieldCitation field = (FieldCitation)builder.InsertField(FieldType.FieldCitation, true);

// A simple citation can have just the page number and author's name
field.SourceTag = "Book1"; // We refer to sources using their tag names
field.PageNumber = "85";
field.SuppressAuthor = false;
field.SuppressTitle = true;
field.SuppressYear = true;

Assert.AreEqual(" CITATION  Book1 \\p 85 \\t \\y", field.GetFieldCode());

// We can make a more detailed citation and make it cite 2 sources
builder.Write("Text to be cited with two sources.");
field = (FieldCitation)builder.InsertField(FieldType.FieldCitation, true);
field.SourceTag = "Book1";
field.AnotherSourceTag = "Book2";
field.FormatLanguageId = "en-US";
field.PageNumber = "19";
field.Prefix = "Prefix ";
field.Suffix = " Suffix";
field.SuppressAuthor = false;
field.SuppressTitle = false;
field.SuppressYear = false;
field.VolumeNumber = "VII";

Assert.AreEqual(" CITATION  Book1 \\m Book2 \\l en-US \\p 19 \\f \"Prefix \" \\s \" Suffix\" \\v VII", field.GetFieldCode());

// Insert a new page which will contain our bibliography
builder.InsertBreak(BreakType.PageBreak);

// All our sources can be displayed using a BIBLIOGRAPHY field
FieldBibliography fieldBibliography = (FieldBibliography)builder.InsertField(FieldType.FieldBibliography, true);
fieldBibliography.FormatLanguageId = "1124";

Assert.AreEqual(" BIBLIOGRAPHY  \\l 1124", fieldBibliography.GetFieldCode());

doc.UpdateFields();
doc.Save(ArtifactsDir + "Field.CITATION.docx");
See Also