Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Introducedin
8.4

...

8.4
Description

Excerpt

Sets the value of the specified property.

Signature
C#
C#
 public void SetDocumentProperty(BuiltInProperty property, System.Object propertyValue)
{signature}{signature:
}
Signature
vb.net
vb.net
Public Sub SetDocumentProperty(ByVal [property] As BuiltInProperty, ByVal propertyValue As Object)
{signature}
{parameters}
{param:property}A [DocumentProperties.BuiltInProperty|DocumentProperties.BuiltInProperty] object that represents the built\-in property to set.{param}
{param:propertyValue}An {{Object}} that represents the value of the property specified.{param}

{exceptions}
{exception:ArgumentException}{{SetDocumentProperty}} will throw this exception if an invalid type is passed for the property.

* _CreationDate_, _EditTime_ and _LastPrintedDate_ must be of type {{System.DateTime}}.
* _RevisionNumber_ must be of type {{int}}.
* _ScaleOrCrop_ and _LinksUpToDate_ must be of type {{Boolean}}.

{exception}


{remarks}
*This feature is available in OOXML files (DOCX/DOCM) only.*

Setting the value to null will clear any existing values.

This is the MS Word equivalent of File menu > Info > Show All Properties:

{web-only:To see what this looks like, go to our online documentation:}
!DocumentProperties.png|thumbnail, border=1! !DocumentPropertiesPanelSelection.png|thumbnail, border=1! !DocumentPropertiesPanel.png|thumbnail, border=1!{web-only}
{remarks}
{example}
{code:csharp|title=C#}
Parameters
Param
property
property

A DocumentProperties.BuiltInProperty object that represents the built-in property to set.

Param
propertyValue
propertyValue

An Object that represents the value of the property specified.

Exceptions
Exception
ArgumentException
ArgumentException

SetDocumentProperty will throw this exception if an invalid type is passed for the property.

  • CreationDate, EditTime and LastPrintedDate must be of type System.DateTime.
  • RevisionNumber must be of type int.
  • ScaleOrCrop and LinksUpToDate must be of type Boolean.
Remarks

This feature is available in OOXML files (DOCX/DOCM) only.

Setting the value to null will clear any existing values.

This is the MS Word equivalent of File menu > Info > Show All Properties:

Web only
To see what this looks like, go to our online documentation:
To see what this looks like, go to our online documentation:

Image Added Image Added !DocumentPropertiesPanel.png|thumbnail, border=1!

Web only

Example
Code Block
csharp
csharp
titleC#


//--- Set "Author" Property
WordTemplate wt = new WordTemplate();
wt.Open(@"c:\templates\Template.doc");
wt.SetDocumentProperty(DocumentProperties.BuiltInProperty.Author, "Jennifer WordSmith");
wt.Process();
wt.Save(@"c:\reports\Report.doc");
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}

//--- Set "Author" Property
Dim wt As New WordTemplate()
wt.Open("c:\templates\Template.docx")
wt.SetDataSource(DocumentProperties.BuiltInProperty.Author, "Jennifer WordSmith")
wt.Process()
wt.Save("c:\reports\Report.docx")
{code} {example}