FieldSubjectText Property
Gets or sets the text of the subject.

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

Property Value

Type: String
Examples
Shows how to use the SUBJECT field.
Document doc = new Document();

// Set a value for the document's subject property
doc.BuiltInDocumentProperties.Subject = "My subject";

// We can display this value with a SUBJECT field
DocumentBuilder builder = new DocumentBuilder(doc);
FieldSubject field = (FieldSubject)builder.InsertField(FieldType.FieldSubject, true);
field.Update();

Assert.AreEqual(" SUBJECT ", field.GetFieldCode());
Assert.AreEqual("My subject", field.Result);

// We can also set the field's Text attribute to override the current value of the Subject property
field.Text = "My new subject";
field.Update();

Assert.AreEqual(" SUBJECT  \"My new subject\"", field.GetFieldCode());
Assert.AreEqual("My new subject", field.Result);

// As well as displaying a new value in our field, we also changed the value of the document property
Assert.AreEqual("My new subject", doc.BuiltInDocumentProperties.Subject);
See Also