IncludeFullPath
Contents
[
Hide
]FieldFileName.IncludeFullPath property
Gets or sets whether to include the full file path name.
public bool IncludeFullPath { get; set; }
Examples
Shows how to use FieldOptions to override the default value for the FILENAME field.
Document doc = new Document(MyDir + "Document.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToDocumentEnd();
builder.Writeln();
// This FILENAME field will display the local system file name of the document we loaded.
FieldFileName field = (FieldFileName)builder.InsertField(FieldType.FieldFileName, true);
field.Update();
Assert.AreEqual(" FILENAME ", field.GetFieldCode());
Assert.AreEqual("Document.docx", field.Result);
builder.Writeln();
// By default, the FILENAME field shows the file's name, but not its full local file system path.
// We can set a flag to make it show the full file path.
field = (FieldFileName)builder.InsertField(FieldType.FieldFileName, true);
field.IncludeFullPath = true;
field.Update();
Assert.AreEqual(MyDir + "Document.docx", field.Result);
// We can also set a value for this property to
// override the value that the FILENAME field displays.
doc.FieldOptions.FileName = "FieldOptions.FILENAME.docx";
field.Update();
Assert.AreEqual(" FILENAME \\p", field.GetFieldCode());
Assert.AreEqual("FieldOptions.FILENAME.docx", field.Result);
doc.UpdateFields();
doc.Save(ArtifactsDir + doc.FieldOptions.FileName);
See Also
- class FieldFileName
- namespace Aspose.Words.Fields
- assembly Aspose.Words