FieldCitation Class
Implements the CITATION field.
Inheritance Hierarchy
SystemObject
  Aspose.Words.FieldsField
    Aspose.Words.FieldsFieldCitation

Namespace: Aspose.Words.Fields
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public class FieldCitation : Field

The FieldCitation type exposes the following members.

Constructors
  NameDescription
Public methodFieldCitation
Initializes a new instance of the FieldCitation class
Properties
  NameDescription
Public propertyCode exampleAnotherSourceTag
Gets or sets a value that mathes the Tag element's value of another source to be included in the citation.
Public propertyCode exampleDisplayResult
Gets the text that represents the displayed field result.
(Inherited from Field.)
Public propertyCode exampleEnd
Gets the node that represents the field end.
(Inherited from Field.)
Public propertyCode exampleFormat
Gets a FieldFormat object that provides typed access to field's formatting.
(Inherited from Field.)
Public propertyCode exampleFormatLanguageId
Gets or sets the language ID that is used in conjunction with the specified bibliographic style to format the citation in the document.
Public propertyCode exampleIsDirty
Gets or sets whether the current result of the field is no longer correct (stale) due to other modifications made to the document.
(Inherited from Field.)
Public propertyCode exampleIsLocked
Gets or sets whether the field is locked (should not recalculate its result).
(Inherited from Field.)
Public propertyCode exampleLocaleId
Gets or sets the LCID of the field.
(Inherited from Field.)
Public propertyCode examplePageNumber
Gets or sets a page number associated with the citation.
Public propertyCode examplePrefix
Gets or sets a prefix that is prepended to the citation.
Public propertyCode exampleResult
Gets or sets text that is between the field separator and field end.
(Inherited from Field.)
Public propertyCode exampleSeparator
Gets the node that represents the field separator. Can be null.
(Inherited from Field.)
Public propertyCode exampleSourceTag
Gets or sets a value that mathes the Tag element's value of the source to insert.
Public propertyCode exampleStart
Gets the node that represents the start of the field.
(Inherited from Field.)
Public propertyCode exampleSuffix
Gets or sets a suffix that is appended to the citation.
Public propertyCode exampleSuppressAuthor
Gets or sets whether the author information is suppressed from the citation.
Public propertyCode exampleSuppressTitle
Gets or sets whether the title information is suppressed from the citation.
Public propertyCode exampleSuppressYear
Gets or sets whether the year information is suppressed from the citation.
Public propertyCode exampleType
Gets the Microsoft Word field type.
(Inherited from Field.)
Public propertyCode exampleVolumeNumber
Gets or sets a volume number associated with the citation.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodCode exampleGetFieldCode
Returns text between field start and field separator (or field end if there is no separator). Both field code and field result of child fields are included.
(Inherited from Field.)
Public methodCode exampleGetFieldCode(Boolean)
Returns text between field start and field separator (or field end if there is no separator).
(Inherited from Field.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodNeedStoreOldResultNodes (Inherited from Field.)
Public methodCode exampleRemove
Removes the field from the document. Returns a node right after the field. If the field's end is the last child of its parent node, returns its parent paragraph. If the field is already removed, returns null.
(Inherited from Field.)
Public methodToString (Inherited from Object.)
Public methodCode exampleUnlink
Performs the field unlink.
(Inherited from Field.)
Public methodCode exampleUpdate
Performs the field update. Throws if the field is being updated already.
(Inherited from Field.)
Public methodCode exampleUpdate(Boolean)
Performs a field update. Throws if the field is being updated already.
(Inherited from Field.)
Remarks
Inserts the contents of the Source element with a specified Tag element using a bibliographic style.
Examples
Shows how to work with CITATION and BIBLIOGRAPHY fields.
// Open a document that has bibliographical sources
Document doc = new Document(MyDir + "Document.HasBibliography.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