UserInformation Class
Specifies information about the user.
Inheritance Hierarchy

Namespace: Aspose.Words.Fields
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 20.1
public class UserInformation

The UserInformation type exposes the following members.

Public methodUserInformation
Initializes a new instance of the UserInformation class
Public propertyCode exampleAddress
Gets or sets the user's postal address.
Public propertyStatic memberCode exampleDefaultUser
Default user information.
Public propertyCode exampleInitials
Gets or sets the user's initials.
Public propertyCode exampleName
Gets or sets the user's name.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Shows how to set user details and display them with fields.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Set user information
UserInformation userInformation = new UserInformation();
userInformation.Name = "John Doe";
userInformation.Initials = "J. D.";
userInformation.Address = "123 Main Street";
doc.FieldOptions.CurrentUser = userInformation;

// Insert fields that reference our user information
Assert.AreEqual(userInformation.Name, builder.InsertField(" USERNAME ").Result);
Assert.AreEqual(userInformation.Initials, builder.InsertField(" USERINITIALS ").Result);
Assert.AreEqual(userInformation.Address, builder.InsertField(" USERADDRESS ").Result);

// The field options object also has a static default user value that fields from many documents can refer to
UserInformation.DefaultUser.Name = "Default User";
UserInformation.DefaultUser.Initials = "D. U.";
UserInformation.DefaultUser.Address = "One Microsoft Way";
doc.FieldOptions.CurrentUser = UserInformation.DefaultUser;

Assert.AreEqual("Default User", builder.InsertField(" USERNAME ").Result);
Assert.AreEqual("D. U.", builder.InsertField(" USERINITIALS ").Result);
Assert.AreEqual("One Microsoft Way", builder.InsertField(" USERADDRESS ").Result);
See Also