UserInformation Class |
Namespace: Aspose.Words.Fields
The UserInformation type exposes the following members.
Name | Description | |
---|---|---|
![]() | UserInformation | Initializes a new instance of the UserInformation class |
Name | Description | |
---|---|---|
![]() ![]() | Address |
Gets or sets the user's postal address.
|
![]() ![]() ![]() | DefaultUser |
Default user information.
|
![]() ![]() | Initials |
Gets or sets the user's initials.
|
![]() ![]() | Name |
Gets or sets the user's name.
|
Name | Description | |
---|---|---|
![]() | Equals | (Inherited from Object.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() | ToString | (Inherited from Object.) |
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); doc.UpdateFields(); doc.Save(ArtifactsDir + "Field.FieldOptionsCurrentUser.docx");