Aspose::Words::Properties::BuiltInDocumentProperties Class Reference

Detailed Description

A collection of built-in document properties.

Provides access to DocumentProperty objects by their names (using an indexer) and via a set of typed properties that return values of appropriate types.

The names of the properties are case-insensitive.

The properties in the collection are sorted alphabetically by name.

See also
Aspose::Words::Document
Aspose::Words::Document::get_BuiltInDocumentProperties
Aspose::Words::Document::get_CustomDocumentProperties
Examples

Shows how to work with built in document properties.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// Some information about the document is stored in member attributes, and can be accessed like this
System::Console::WriteLine(String::Format(u"Document filename:\n\t \"{0}\"",doc->get_OriginalFileName()));
// The majority of metadata, such as author name, file size,
// word/page counts can be found in the built in properties collection like this
System::Console::WriteLine(u"Built-in Properties:");
for (auto docProperty : System::IterateOver(doc->get_BuiltInDocumentProperties()))
{
System::Console::WriteLine(docProperty->get_Name());
System::Console::WriteLine(String::Format(u"\tType:\t{0}",docProperty->get_Type()));
// Some properties may store multiple values
if (System::ObjectExt::Is<System::Collections::Generic::ICollection<SharedPtr<System::Object>>>(docProperty->get_Value()))
{
for (auto value : System::IterateOver(System::DynamicCast_noexcept<System::Collections::Generic::ICollection<SharedPtr<System::Object>>>(docProperty->get_Value())))
{
System::Console::WriteLine(String::Format(u"\tValue:\t\"{0}\"",value));
}
}
else
{
System::Console::WriteLine(String::Format(u"\tValue:\t\"{0}\"",docProperty->get_Value()));
}
}

#include <Aspose.Words.Cpp/Model/Properties/BuiltInDocumentProperties.h>

+ Inheritance diagram for Aspose::Words::Properties::BuiltInDocumentProperties:

Public Member Functions

String get_Author ()
 Gets or sets the name of the document's author. More...
 
int32_t get_Bytes ()
 Represents an estimate of the number of bytes in the document. More...
 
String get_Category ()
 Gets or sets the category of the document. More...
 
int32_t get_Characters ()
 Represents an estimate of the number of characters in the document. More...
 
int32_t get_CharactersWithSpaces ()
 Represents an estimate of the number of characters (including spaces) in the document. More...
 
String get_Comments ()
 Gets or sets the document comments. More...
 
String get_Company ()
 Gets or sets the company property. More...
 
String get_ContentStatus ()
 Gets the ContentStatus of the document. More...
 
String get_ContentType ()
 Gets the ContentStatus of the document. More...
 
DateTime get_CreatedTime ()
 Gets or sets date of the document creation in UTC. More...
 
ArrayPtr< SharedPtr< Object > > get_HeadingPairs ()
 Specifies document headings and their names. More...
 
String get_HyperlinkBase ()
 Specifies the base string used for evaluating relative hyperlinks in this document. More...
 
String get_Keywords ()
 Gets or sets the document keywords. More...
 
DateTime get_LastPrinted ()
 Gets or sets the date when the document was last printed in UTC. More...
 
String get_LastSavedBy ()
 Gets or sets the name of the last author. More...
 
DateTime get_LastSavedTime ()
 Gets or sets the time of the last save in UTC. More...
 
int32_t get_Lines ()
 Represents an estimate of the number of lines in the document. More...
 
bool get_LinksUpToDate ()
 Indicates whether hyperlinks in a document are up-to-date. More...
 
String get_Manager ()
 Gets or sets the manager property. More...
 
String get_NameOfApplication ()
 Gets or sets the name of the application. More...
 
int32_t get_Pages ()
 Represents an estimate of the number of pages in the document. More...
 
int32_t get_Paragraphs ()
 Represents an estimate of the number of paragraphs in the document. More...
 
int32_t get_RevisionNumber ()
 Gets or sets the document revision number. More...
 
DocumentSecurity get_Security ()
 Specifies the security level of a document as a numeric value. More...
 
String get_Subject ()
 Gets or sets the subject of the document. More...
 
String get_Template ()
 Gets or sets the informational name of the document template. More...
 
ArrayPtr< uint8_t > get_Thumbnail ()
 Gets or sets the thumbnail of the document. More...
 
String get_Title ()
 Gets or sets the title of the document. More...
 
ArrayPtr< Stringget_TitlesOfParts ()
 Each string in the array specifies the name of a part in the document. More...
 
int32_t get_TotalEditingTime ()
 Gets or sets the total editing time in minutes. More...
 
int32_t get_Version ()
 Represents the version number of the application that created the document. More...
 
int32_t get_Words ()
 Represents an estimate of the number of words in the document. More...
 
virtual const TypeInfoGetType () const override
 
SharedPtr< DocumentPropertyidx_get (String name) override
 Returns a DocumentProperty object by the name of the property. More...
 
virtual bool Is (const TypeInfo &target) const override
 
void set_Author (String value)
 Setter for get_Author. More...
 
void set_Bytes (int32_t value)
 Setter for get_Bytes. More...
 
void set_Category (String value)
 Setter for get_Category. More...
 
void set_Characters (int32_t value)
 Setter for get_Characters. More...
 
void set_CharactersWithSpaces (int32_t value)
 Represents an estimate of the number of characters (including spaces) in the document. More...
 
void set_Comments (String value)
 Setter for get_Comments. More...
 
void set_Company (String value)
 Setter for get_Company. More...
 
void set_ContentStatus (String value)
 Sets the ContentStatus of the document. More...
 
void set_ContentType (String value)
 Sets the ContentStatus of the document. More...
 
void set_CreatedTime (DateTime value)
 Setter for get_CreatedTime. More...
 
void set_HeadingPairs (ArrayPtr< SharedPtr< Object >> value)
 Setter for get_HeadingPairs. More...
 
void set_HyperlinkBase (String value)
 Setter for get_HyperlinkBase. More...
 
void set_Keywords (String value)
 Setter for get_Keywords. More...
 
void set_LastPrinted (DateTime value)
 Setter for get_LastPrinted. More...
 
void set_LastSavedBy (String value)
 Setter for get_LastSavedBy. More...
 
void set_LastSavedTime (DateTime value)
 Setter for get_LastSavedTime. More...
 
void set_Lines (int32_t value)
 Setter for get_Lines. More...
 
void set_LinksUpToDate (bool value)
 Indicates whether hyperlinks in a document are up-to-date. More...
 
void set_Manager (String value)
 Setter for get_Manager. More...
 
void set_NameOfApplication (String value)
 Setter for get_NameOfApplication. More...
 
void set_Pages (int32_t value)
 Represents an estimate of the number of pages in the document. More...
 
void set_Paragraphs (int32_t value)
 Setter for get_Paragraphs. More...
 
void set_RevisionNumber (int32_t value)
 Setter for get_RevisionNumber. More...
 
void set_Security (DocumentSecurity value)
 Setter for get_Security. More...
 
void set_Subject (String value)
 Setter for get_Subject. More...
 
void set_Template (String value)
 Setter for get_Template. More...
 
void set_Thumbnail (ArrayPtr< uint8_t > value)
 Setter for get_Thumbnail. More...
 
void set_Title (String value)
 Setter for get_Title. More...
 
void set_TitlesOfParts (ArrayPtr< String > value)
 Setter for get_TitlesOfParts. More...
 
void set_TotalEditingTime (int32_t value)
 Setter for get_TotalEditingTime. More...
 
void set_Version (int32_t value)
 Setter for get_Version. More...
 
void set_Words (int32_t value)
 Setter for get_Words. More...
 
- Public Member Functions inherited from DocumentPropertyCollection
void Clear ()
 Removes all properties from the collection. More...
 
bool Contains (String name)
 Returns true if a property with the specified name exists in the collection. More...
 
int32_t get_Count ()
 Gets number of items in the collection. More...
 
SharedPtr< IEnumerator< SharedPtr< DocumentProperty > > > GetEnumerator () override
 Returns an enumerator object that can be used to iterate over all items in the collection. More...
 
SharedPtr< DocumentPropertyidx_get (int32_t index)
 Returns a DocumentProperty object by index. More...
 
int32_t IndexOf (String name)
 Gets the index of a property by name. More...
 
void Remove (String name)
 Removes a property with the specified name from the collection. More...
 
void RemoveAt (int32_t index)
 Removes a property at the specified index. More...
 
- Public Member Functions inherited from System::Collections::Generic::IEnumerable< System::SharedPtr< Aspose::Words::Properties::DocumentProperty > >
EnumeratorBasedIterator< T, IEnumerator< T > > begin () noexcept
 
EnumeratorBasedIterator< T, IEnumerator< T > > cbegin () noexcept
 
EnumeratorBasedIterator< T, IEnumerator< T > > cend () noexcept
 
EnumeratorBasedIterator< T, IEnumerator< T > > end () noexcept
 
bool LINQ_All (std::function< bool(T)> predicate)
 
bool LINQ_Any ()
 
bool LINQ_Any (std::function< bool(T)> predicate)
 
SharedPtr< IEnumerable< ResultType > > LINQ_Cast ()
 
SharedPtr< IEnumerable< Result > > LINQ_Cast ()
 
bool LINQ_Contains (T value)
 
int LINQ_Count ()
 
int LINQ_Count (const Func< T, bool > &predicate)
 
LINQ_ElementAt (int index)
 
LINQ_First ()
 
LINQ_First (const Func< T, bool > &predicate)
 
LINQ_FirstOrDefault ()
 
LINQ_FirstOrDefault (std::function< bool(T)> predicate)
 
LINQ_Last ()
 
LINQ_LastOrDefault ()
 
SharedPtr< IEnumerable< ResultType > > LINQ_OfType ()
 
SharedPtr< IEnumerable< Result > > LINQ_OfType ()
 
SharedPtr< IEnumerable< Source > > LINQ_OrderBy (const Func< Source, Key > &keySelector)
 
SharedPtr< IEnumerable< T > > LINQ_OrderBy (const Func< T, Key > &keySelector)
 
SharedPtr< IEnumerable< Result > > LINQ_Select (const Func< Source, Result > &selector)
 
SharedPtr< IEnumerable< ResultType > > LINQ_Select (const Func< T, ResultType > &selector)
 
ArrayPtr< T > LINQ_ToArray ()
 
SharedPtr< List< T > > LINQ_ToList ()
 
SharedPtr< IEnumerable< T > > LINQ_Where (std::function< bool(T)> predicate)
 
- Public Member Functions inherited from Object
ASPOSECPP_SHARED_API Object ()
 
ASPOSECPP_SHARED_API Object (Object const &x)
 
virtual ASPOSECPP_SHARED_API ~Object ()
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 
Detail::SmartPtrCounter * GetCounter ()
 
virtual ASPOSECPP_SHARED_API int GetHashCode () const
 
ASPOSECPP_SHARED_API void Lock ()
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 
Objectoperator= (Object const &x)
 
bool ReferenceEquals (String const &str, std::nullptr_t)
 
bool ReferenceEquals (String const &str1, String const &str2)
 
int RemovedSharedRefs (int count)
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (unsigned int argument)
 
int SharedCount () const
 
ObjectSharedRefAdded ()
 
int SharedRefRemovedSafe ()
 
virtual ASPOSECPP_SHARED_API String ToString () const
 
ASPOSECPP_SHARED_API void Unlock ()
 
Detail::SmartPtrCounter * WeakRefAdded ()
 
void WeakRefRemoved ()
 

Static Public Member Functions

static const TypeInfoType ()
 
- Static Public Member Functions inherited from DocumentPropertyCollection
static const TypeInfoType ()
 
- Static Public Member Functions inherited from Object
bool Equals (double const &objA, double const &objB)
 
bool Equals (float const &objA, float const &objB)
 
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 
static const TypeInfoType ()
 

Additional Inherited Members

- Public Types inherited from System::Collections::Generic::IEnumerable< System::SharedPtr< Aspose::Words::Properties::DocumentProperty > >
typedef IEnumerator< T > IEnumeratorType
 
typedef T ValueType
 
- Public Types inherited from Object
typedef SmartPtr< Objectptr
 
typedef System::Details::SharedMembersType shared_members_type
 

Member Function Documentation

◆ get_Author()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_Author ( )

Gets or sets the name of the document's author.

Examples

Shows how to work with document properties in the "Description" category.

auto doc = MakeObject<Document>();
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Set the values of some descriptive properties
// These are metadata that can be glanced at without opening the document in the "Details" or "Content" folder views in Windows Explorer
// The "Details" view has columns dedicated to these properties
// Fields such as AUTHOR, SUBJECT, TITLE etc. can be used to display these values inside the document
properties->set_Author(u"John Doe");
properties->set_Title(u"John's Document");
properties->set_Subject(u"My subject");
properties->set_Category(u"My category");
properties->set_Comments(String::Format(u"This is {0}'s document about {1}",properties->get_Author(),properties->get_Subject()));
// Tags can be used as keywords and are separated by semicolons
properties->set_Keywords(u"Tag 1; Tag 2; Tag 3");
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Description
doc->Save(ArtifactsDir + u"Properties.Description.docx");

◆ get_Bytes()

int32_t Aspose::Words::Properties::BuiltInDocumentProperties::get_Bytes ( )

Represents an estimate of the number of bytes in the document.

Microsoft Word does not always set this property.

Aspose.Words does not update this property.

◆ get_Category()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_Category ( )

Gets or sets the category of the document.

Examples

Shows how to work with document properties in the "Description" category.

auto doc = MakeObject<Document>();
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Set the values of some descriptive properties
// These are metadata that can be glanced at without opening the document in the "Details" or "Content" folder views in Windows Explorer
// The "Details" view has columns dedicated to these properties
// Fields such as AUTHOR, SUBJECT, TITLE etc. can be used to display these values inside the document
properties->set_Author(u"John Doe");
properties->set_Title(u"John's Document");
properties->set_Subject(u"My subject");
properties->set_Category(u"My category");
properties->set_Comments(String::Format(u"This is {0}'s document about {1}",properties->get_Author(),properties->get_Subject()));
// Tags can be used as keywords and are separated by semicolons
properties->set_Keywords(u"Tag 1; Tag 2; Tag 3");
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Description
doc->Save(ArtifactsDir + u"Properties.Description.docx");

◆ get_Characters()

int32_t Aspose::Words::Properties::BuiltInDocumentProperties::get_Characters ( )

Represents an estimate of the number of characters in the document.

Aspose.Words updates this property when you call UpdateWordCount.

Examples

Shows how to update all list labels in a document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Add a paragraph of text to the document
builder->Writeln(String(u"Lorem ipsum dolor sit amet, consectetur adipiscing elit, ") + u"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
builder->Write(String(u"Ut enim ad minim veniam, ") + u"quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.");
// Document metrics are not tracked in code in real time
ASSERT_EQ(0, doc->get_BuiltInDocumentProperties()->get_Characters());
ASSERT_EQ(0, doc->get_BuiltInDocumentProperties()->get_Words());
ASSERT_EQ(1, doc->get_BuiltInDocumentProperties()->get_Paragraphs());
ASSERT_EQ(1, doc->get_BuiltInDocumentProperties()->get_Lines());
// We will need to call this method to update them
doc->UpdateWordCount();
// Check the values of the properties
ASSERT_EQ(196, doc->get_BuiltInDocumentProperties()->get_Characters());
ASSERT_EQ(36, doc->get_BuiltInDocumentProperties()->get_Words());
ASSERT_EQ(2, doc->get_BuiltInDocumentProperties()->get_Paragraphs());
ASSERT_EQ(1, doc->get_BuiltInDocumentProperties()->get_Lines());
// To also get the line count as it would appear in Microsoft Word,
// we will need to pass "true" to UpdateWordCount()
doc->UpdateWordCount(true);
ASSERT_EQ(4, doc->get_BuiltInDocumentProperties()->get_Lines());

◆ get_CharactersWithSpaces()

int32_t Aspose::Words::Properties::BuiltInDocumentProperties::get_CharactersWithSpaces ( )

Represents an estimate of the number of characters (including spaces) in the document.

Aspose.Words updates this property when you call UpdateWordCount.

◆ get_Comments()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_Comments ( )

Gets or sets the document comments.

Examples

Shows how to work with document properties in the "Description" category.

auto doc = MakeObject<Document>();
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Set the values of some descriptive properties
// These are metadata that can be glanced at without opening the document in the "Details" or "Content" folder views in Windows Explorer
// The "Details" view has columns dedicated to these properties
// Fields such as AUTHOR, SUBJECT, TITLE etc. can be used to display these values inside the document
properties->set_Author(u"John Doe");
properties->set_Title(u"John's Document");
properties->set_Subject(u"My subject");
properties->set_Category(u"My category");
properties->set_Comments(String::Format(u"This is {0}'s document about {1}",properties->get_Author(),properties->get_Subject()));
// Tags can be used as keywords and are separated by semicolons
properties->set_Keywords(u"Tag 1; Tag 2; Tag 3");
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Description
doc->Save(ArtifactsDir + u"Properties.Description.docx");

◆ get_Company()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_Company ( )

Gets or sets the company property.

Examples

Shows how to work with document properties in the "Origin" category.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Since this document has been edited and printed in the past, values generated by Microsoft Word will appear here
// These values can be glanced at by right clicking the file in Windows Explorer, without actually opening the document
// Fields such as PRINTDATE, EDITTIME etc. can display these values inside the document
System::Console::WriteLine(String::Format(u"Created using {0}, on {1}",properties->get_NameOfApplication(),properties->get_CreatedTime()));
System::Console::WriteLine(String::Format(u"Minutes spent editing: {0}",properties->get_TotalEditingTime()));
System::Console::WriteLine(String::Format(u"Date/time last printed: {0}",properties->get_LastPrinted()));
System::Console::WriteLine(String::Format(u"Template document: {0}",properties->get_Template()));
// We can set these properties ourselves
properties->set_Company(u"Doe Ltd.");
properties->set_Manager(u"Jane Doe");
properties->set_Version(5);
properties->set_RevisionNumber(properties->get_RevisionNumber() + 1);
// If we plan on programmatically saving the document, we may record some details like this
properties->set_LastSavedBy(u"John Doe");
properties->set_LastSavedTime(System::DateTime::get_Now());
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Origin
doc->Save(ArtifactsDir + u"Properties.Origin.docx");

◆ get_ContentStatus()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_ContentStatus ( )

Gets the ContentStatus of the document.

◆ get_ContentType()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_ContentType ( )

Gets the ContentStatus of the document.

◆ get_CreatedTime()

System::DateTime Aspose::Words::Properties::BuiltInDocumentProperties::get_CreatedTime ( )

Gets or sets date of the document creation in UTC.

For documents originated from RTF format this property returns local time of the author's machine at the moment of document creation.

Aspose.Words does not update this property.

Examples

Shows how to work with document properties in the "Origin" category.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Since this document has been edited and printed in the past, values generated by Microsoft Word will appear here
// These values can be glanced at by right clicking the file in Windows Explorer, without actually opening the document
// Fields such as PRINTDATE, EDITTIME etc. can display these values inside the document
System::Console::WriteLine(String::Format(u"Created using {0}, on {1}",properties->get_NameOfApplication(),properties->get_CreatedTime()));
System::Console::WriteLine(String::Format(u"Minutes spent editing: {0}",properties->get_TotalEditingTime()));
System::Console::WriteLine(String::Format(u"Date/time last printed: {0}",properties->get_LastPrinted()));
System::Console::WriteLine(String::Format(u"Template document: {0}",properties->get_Template()));
// We can set these properties ourselves
properties->set_Company(u"Doe Ltd.");
properties->set_Manager(u"Jane Doe");
properties->set_Version(5);
properties->set_RevisionNumber(properties->get_RevisionNumber() + 1);
// If we plan on programmatically saving the document, we may record some details like this
properties->set_LastSavedBy(u"John Doe");
properties->set_LastSavedTime(System::DateTime::get_Now());
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Origin
doc->Save(ArtifactsDir + u"Properties.Origin.docx");

◆ get_HeadingPairs()

System::ArrayPtr<System::SharedPtr<System::Object> > Aspose::Words::Properties::BuiltInDocumentProperties::get_HeadingPairs ( )

Specifies document headings and their names.

Every heading pair occupies two elements in this array.

The first element of the pair is a String and specifies the heading name. The second element of the pair is an Int32 and specifies the count of document parts for this heading in the TitlesOfParts property.

The total sum of counts for all heading pairs in this property must be equal to the number of elements in the TitlesOfParts property.

Aspose.Words does not update this property.

See also
Aspose::Words::Properties::BuiltInDocumentProperties::get_TitlesOfParts
Examples

Shows the relationship between HeadingPairs and TitlesOfParts properties.

// Open a document that contains entries in the HeadingPairs/TitlesOfParts properties
auto doc = MakeObject<Document>(MyDir + u"Heading pairs and titles of parts.docx");
// We can find the combined values of these collections in File > Properties > Advanced Properties > Contents tab
// The HeadingPairs property is a collection of <string, int> pairs that determines
// how many document parts a heading spans over
ArrayPtr<SharedPtr<System::Object>> headingPairs = doc->get_BuiltInDocumentProperties()->get_HeadingPairs();
// The TitlesOfParts property contains the names of parts that belong to the above headings
ArrayPtr<String> titlesOfParts = doc->get_BuiltInDocumentProperties()->get_TitlesOfParts();
int headingPairsIndex = 0;
int titlesOfPartsIndex = 0;
while (headingPairsIndex < headingPairs->get_Length())
{
System::Console::WriteLine(String::Format(u"Parts for {0}:",headingPairs[headingPairsIndex++]));
int partsCount = System::Convert::ToInt32(headingPairs[headingPairsIndex++]);
for (int i = 0; i < partsCount; i++)
{
System::Console::WriteLine(String::Format(u"\t\"{0}\"",titlesOfParts[titlesOfPartsIndex++]));
}
}

◆ get_HyperlinkBase()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_HyperlinkBase ( )

Specifies the base string used for evaluating relative hyperlinks in this document.

Aspose.Words does not use this property.

Examples

Shows how to store the base part of a hyperlink in the document's properties.

// Create a blank document and a DocumentBuilder
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Insert a relative hyperlink to "Document.docx", which will open that document when clicked on
builder->InsertHyperlink(u"Relative hyperlink", u"Document.docx", false);
// If we don't have a "Document.docx" in the same folder as the document we are about to save, we will end up with a broken link
ASSERT_FALSE(System::IO::File::Exists(ArtifactsDir + u"Document.docx"));
doc->Save(ArtifactsDir + u"Properties.HyperlinkBase.BrokenLink.docx");
// We could keep prepending something like "C:\users\...\data" to every hyperlink we place to remedy this
// Alternatively, if we know that all our linked files will come from the same folder,
// we could set a base hyperlink in the document properties, keeping our hyperlinks short
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
properties->set_HyperlinkBase(MyDir);
ASSERT_TRUE(System::IO::File::Exists(properties->get_HyperlinkBase() + (System::DynamicCast<Aspose::Words::Fields::FieldHyperlink>(doc->get_Range()->get_Fields()->idx_get(0)))->get_Address()));
doc->Save(ArtifactsDir + u"Properties.HyperlinkBase.WorkingLink.docx");

◆ get_Keywords()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_Keywords ( )

Gets or sets the document keywords.

Examples

Shows how to work with document properties in the "Description" category.

auto doc = MakeObject<Document>();
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Set the values of some descriptive properties
// These are metadata that can be glanced at without opening the document in the "Details" or "Content" folder views in Windows Explorer
// The "Details" view has columns dedicated to these properties
// Fields such as AUTHOR, SUBJECT, TITLE etc. can be used to display these values inside the document
properties->set_Author(u"John Doe");
properties->set_Title(u"John's Document");
properties->set_Subject(u"My subject");
properties->set_Category(u"My category");
properties->set_Comments(String::Format(u"This is {0}'s document about {1}",properties->get_Author(),properties->get_Subject()));
// Tags can be used as keywords and are separated by semicolons
properties->set_Keywords(u"Tag 1; Tag 2; Tag 3");
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Description
doc->Save(ArtifactsDir + u"Properties.Description.docx");

◆ get_LastPrinted()

System::DateTime Aspose::Words::Properties::BuiltInDocumentProperties::get_LastPrinted ( )

Gets or sets the date when the document was last printed in UTC.

For documents originated from RTF format this property returns the local time of last print operation.

If the document was never printed, this property will return DateTime.MinValue.

Aspose.Words does not update this property.

Examples

Shows how to work with document properties in the "Origin" category.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Since this document has been edited and printed in the past, values generated by Microsoft Word will appear here
// These values can be glanced at by right clicking the file in Windows Explorer, without actually opening the document
// Fields such as PRINTDATE, EDITTIME etc. can display these values inside the document
System::Console::WriteLine(String::Format(u"Created using {0}, on {1}",properties->get_NameOfApplication(),properties->get_CreatedTime()));
System::Console::WriteLine(String::Format(u"Minutes spent editing: {0}",properties->get_TotalEditingTime()));
System::Console::WriteLine(String::Format(u"Date/time last printed: {0}",properties->get_LastPrinted()));
System::Console::WriteLine(String::Format(u"Template document: {0}",properties->get_Template()));
// We can set these properties ourselves
properties->set_Company(u"Doe Ltd.");
properties->set_Manager(u"Jane Doe");
properties->set_Version(5);
properties->set_RevisionNumber(properties->get_RevisionNumber() + 1);
// If we plan on programmatically saving the document, we may record some details like this
properties->set_LastSavedBy(u"John Doe");
properties->set_LastSavedTime(System::DateTime::get_Now());
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Origin
doc->Save(ArtifactsDir + u"Properties.Origin.docx");

◆ get_LastSavedBy()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_LastSavedBy ( )

Gets or sets the name of the last author.

Aspose.Words does not update this property.

Examples

Shows how to work with document properties in the "Origin" category.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Since this document has been edited and printed in the past, values generated by Microsoft Word will appear here
// These values can be glanced at by right clicking the file in Windows Explorer, without actually opening the document
// Fields such as PRINTDATE, EDITTIME etc. can display these values inside the document
System::Console::WriteLine(String::Format(u"Created using {0}, on {1}",properties->get_NameOfApplication(),properties->get_CreatedTime()));
System::Console::WriteLine(String::Format(u"Minutes spent editing: {0}",properties->get_TotalEditingTime()));
System::Console::WriteLine(String::Format(u"Date/time last printed: {0}",properties->get_LastPrinted()));
System::Console::WriteLine(String::Format(u"Template document: {0}",properties->get_Template()));
// We can set these properties ourselves
properties->set_Company(u"Doe Ltd.");
properties->set_Manager(u"Jane Doe");
properties->set_Version(5);
properties->set_RevisionNumber(properties->get_RevisionNumber() + 1);
// If we plan on programmatically saving the document, we may record some details like this
properties->set_LastSavedBy(u"John Doe");
properties->set_LastSavedTime(System::DateTime::get_Now());
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Origin
doc->Save(ArtifactsDir + u"Properties.Origin.docx");

◆ get_LastSavedTime()

System::DateTime Aspose::Words::Properties::BuiltInDocumentProperties::get_LastSavedTime ( )

Gets or sets the time of the last save in UTC.

For documents originated from RTF format this property returns the local time of last save operation.

Aspose.Words does not update this property.

Examples

Shows how to work with document properties in the "Origin" category.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Since this document has been edited and printed in the past, values generated by Microsoft Word will appear here
// These values can be glanced at by right clicking the file in Windows Explorer, without actually opening the document
// Fields such as PRINTDATE, EDITTIME etc. can display these values inside the document
System::Console::WriteLine(String::Format(u"Created using {0}, on {1}",properties->get_NameOfApplication(),properties->get_CreatedTime()));
System::Console::WriteLine(String::Format(u"Minutes spent editing: {0}",properties->get_TotalEditingTime()));
System::Console::WriteLine(String::Format(u"Date/time last printed: {0}",properties->get_LastPrinted()));
System::Console::WriteLine(String::Format(u"Template document: {0}",properties->get_Template()));
// We can set these properties ourselves
properties->set_Company(u"Doe Ltd.");
properties->set_Manager(u"Jane Doe");
properties->set_Version(5);
properties->set_RevisionNumber(properties->get_RevisionNumber() + 1);
// If we plan on programmatically saving the document, we may record some details like this
properties->set_LastSavedBy(u"John Doe");
properties->set_LastSavedTime(System::DateTime::get_Now());
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Origin
doc->Save(ArtifactsDir + u"Properties.Origin.docx");

◆ get_Lines()

int32_t Aspose::Words::Properties::BuiltInDocumentProperties::get_Lines ( )

Represents an estimate of the number of lines in the document.

Aspose.Words updates this property when you call UpdateWordCount().

Examples

Shows how to update all list labels in a document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Add a paragraph of text to the document
builder->Writeln(String(u"Lorem ipsum dolor sit amet, consectetur adipiscing elit, ") + u"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
builder->Write(String(u"Ut enim ad minim veniam, ") + u"quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.");
// Document metrics are not tracked in code in real time
ASSERT_EQ(0, doc->get_BuiltInDocumentProperties()->get_Characters());
ASSERT_EQ(0, doc->get_BuiltInDocumentProperties()->get_Words());
ASSERT_EQ(1, doc->get_BuiltInDocumentProperties()->get_Paragraphs());
ASSERT_EQ(1, doc->get_BuiltInDocumentProperties()->get_Lines());
// We will need to call this method to update them
doc->UpdateWordCount();
// Check the values of the properties
ASSERT_EQ(196, doc->get_BuiltInDocumentProperties()->get_Characters());
ASSERT_EQ(36, doc->get_BuiltInDocumentProperties()->get_Words());
ASSERT_EQ(2, doc->get_BuiltInDocumentProperties()->get_Paragraphs());
ASSERT_EQ(1, doc->get_BuiltInDocumentProperties()->get_Lines());
// To also get the line count as it would appear in Microsoft Word,
// we will need to pass "true" to UpdateWordCount()
doc->UpdateWordCount(true);
ASSERT_EQ(4, doc->get_BuiltInDocumentProperties()->get_Lines());

◆ get_LinksUpToDate()

bool Aspose::Words::Properties::BuiltInDocumentProperties::get_LinksUpToDate ( )

Indicates whether hyperlinks in a document are up-to-date.

Aspose.Words does not update this property.

◆ get_Manager()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_Manager ( )

Gets or sets the manager property.

Examples

Shows how to work with document properties in the "Origin" category.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Since this document has been edited and printed in the past, values generated by Microsoft Word will appear here
// These values can be glanced at by right clicking the file in Windows Explorer, without actually opening the document
// Fields such as PRINTDATE, EDITTIME etc. can display these values inside the document
System::Console::WriteLine(String::Format(u"Created using {0}, on {1}",properties->get_NameOfApplication(),properties->get_CreatedTime()));
System::Console::WriteLine(String::Format(u"Minutes spent editing: {0}",properties->get_TotalEditingTime()));
System::Console::WriteLine(String::Format(u"Date/time last printed: {0}",properties->get_LastPrinted()));
System::Console::WriteLine(String::Format(u"Template document: {0}",properties->get_Template()));
// We can set these properties ourselves
properties->set_Company(u"Doe Ltd.");
properties->set_Manager(u"Jane Doe");
properties->set_Version(5);
properties->set_RevisionNumber(properties->get_RevisionNumber() + 1);
// If we plan on programmatically saving the document, we may record some details like this
properties->set_LastSavedBy(u"John Doe");
properties->set_LastSavedTime(System::DateTime::get_Now());
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Origin
doc->Save(ArtifactsDir + u"Properties.Origin.docx");

◆ get_NameOfApplication()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_NameOfApplication ( )

Gets or sets the name of the application.

Examples

Shows how to work with document properties in the "Origin" category.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Since this document has been edited and printed in the past, values generated by Microsoft Word will appear here
// These values can be glanced at by right clicking the file in Windows Explorer, without actually opening the document
// Fields such as PRINTDATE, EDITTIME etc. can display these values inside the document
System::Console::WriteLine(String::Format(u"Created using {0}, on {1}",properties->get_NameOfApplication(),properties->get_CreatedTime()));
System::Console::WriteLine(String::Format(u"Minutes spent editing: {0}",properties->get_TotalEditingTime()));
System::Console::WriteLine(String::Format(u"Date/time last printed: {0}",properties->get_LastPrinted()));
System::Console::WriteLine(String::Format(u"Template document: {0}",properties->get_Template()));
// We can set these properties ourselves
properties->set_Company(u"Doe Ltd.");
properties->set_Manager(u"Jane Doe");
properties->set_Version(5);
properties->set_RevisionNumber(properties->get_RevisionNumber() + 1);
// If we plan on programmatically saving the document, we may record some details like this
properties->set_LastSavedBy(u"John Doe");
properties->set_LastSavedTime(System::DateTime::get_Now());
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Origin
doc->Save(ArtifactsDir + u"Properties.Origin.docx");

◆ get_Pages()

int32_t Aspose::Words::Properties::BuiltInDocumentProperties::get_Pages ( )

Represents an estimate of the number of pages in the document.

Aspose.Words updates this property when you call UpdatePageLayout.

◆ get_Paragraphs()

int32_t Aspose::Words::Properties::BuiltInDocumentProperties::get_Paragraphs ( )

Represents an estimate of the number of paragraphs in the document.

Aspose.Words updates this property when you call UpdateWordCount.

Examples

Shows how to update all list labels in a document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Add a paragraph of text to the document
builder->Writeln(String(u"Lorem ipsum dolor sit amet, consectetur adipiscing elit, ") + u"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
builder->Write(String(u"Ut enim ad minim veniam, ") + u"quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.");
// Document metrics are not tracked in code in real time
ASSERT_EQ(0, doc->get_BuiltInDocumentProperties()->get_Characters());
ASSERT_EQ(0, doc->get_BuiltInDocumentProperties()->get_Words());
ASSERT_EQ(1, doc->get_BuiltInDocumentProperties()->get_Paragraphs());
ASSERT_EQ(1, doc->get_BuiltInDocumentProperties()->get_Lines());
// We will need to call this method to update them
doc->UpdateWordCount();
// Check the values of the properties
ASSERT_EQ(196, doc->get_BuiltInDocumentProperties()->get_Characters());
ASSERT_EQ(36, doc->get_BuiltInDocumentProperties()->get_Words());
ASSERT_EQ(2, doc->get_BuiltInDocumentProperties()->get_Paragraphs());
ASSERT_EQ(1, doc->get_BuiltInDocumentProperties()->get_Lines());
// To also get the line count as it would appear in Microsoft Word,
// we will need to pass "true" to UpdateWordCount()
doc->UpdateWordCount(true);
ASSERT_EQ(4, doc->get_BuiltInDocumentProperties()->get_Lines());

◆ get_RevisionNumber()

int32_t Aspose::Words::Properties::BuiltInDocumentProperties::get_RevisionNumber ( )

Gets or sets the document revision number.

Aspose.Words does not update this property.

Examples

Shows how to work with document properties in the "Origin" category.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Since this document has been edited and printed in the past, values generated by Microsoft Word will appear here
// These values can be glanced at by right clicking the file in Windows Explorer, without actually opening the document
// Fields such as PRINTDATE, EDITTIME etc. can display these values inside the document
System::Console::WriteLine(String::Format(u"Created using {0}, on {1}",properties->get_NameOfApplication(),properties->get_CreatedTime()));
System::Console::WriteLine(String::Format(u"Minutes spent editing: {0}",properties->get_TotalEditingTime()));
System::Console::WriteLine(String::Format(u"Date/time last printed: {0}",properties->get_LastPrinted()));
System::Console::WriteLine(String::Format(u"Template document: {0}",properties->get_Template()));
// We can set these properties ourselves
properties->set_Company(u"Doe Ltd.");
properties->set_Manager(u"Jane Doe");
properties->set_Version(5);
properties->set_RevisionNumber(properties->get_RevisionNumber() + 1);
// If we plan on programmatically saving the document, we may record some details like this
properties->set_LastSavedBy(u"John Doe");
properties->set_LastSavedTime(System::DateTime::get_Now());
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Origin
doc->Save(ArtifactsDir + u"Properties.Origin.docx");

◆ get_Security()

Aspose::Words::Properties::DocumentSecurity Aspose::Words::Properties::BuiltInDocumentProperties::get_Security ( )

Specifies the security level of a document as a numeric value.

Use this property for informational purposes only because Microsoft Word does not always set this property. This property is available in DOC and OOXML documents only.

To protect or unprotect a document use the Protect() and Unprotect methods.

Aspose.Words updates this property to a correct value before saving a document.

Examples

Shows how to use document properties to display the security level of a document.

auto doc = MakeObject<Document>();
// The "Security" property serves as a description of the security level of a document
ASSERT_EQ(Aspose::Words::Properties::DocumentSecurity::None, doc->get_BuiltInDocumentProperties()->get_Security());
// Upon saving a document after setting its security level, Aspose automatically updates this property to the appropriate value
doc->get_WriteProtection()->set_ReadOnlyRecommended(true);
doc->Save(ArtifactsDir + u"Properties.Security.ReadOnlyRecommended.docx");
// Open a document and verify its security level
ASSERT_EQ(Aspose::Words::Properties::DocumentSecurity::ReadOnlyRecommended, MakeObject<Document>(ArtifactsDir + u"Properties.Security.ReadOnlyRecommended.docx")->get_BuiltInDocumentProperties()->get_Security());
// Create a new document and set it to Write-Protected
doc = MakeObject<Document>();
ASSERT_FALSE(doc->get_WriteProtection()->get_IsWriteProtected());
doc->get_WriteProtection()->SetPassword(u"MyPassword");
ASSERT_TRUE(doc->get_WriteProtection()->ValidatePassword(u"MyPassword"));
ASSERT_TRUE(doc->get_WriteProtection()->get_IsWriteProtected());
doc->Save(ArtifactsDir + u"Properties.Security.ReadOnlyEnforced.docx");
// This document's security level counts as "ReadOnlyEnforced"
ASSERT_EQ(Aspose::Words::Properties::DocumentSecurity::ReadOnlyEnforced, MakeObject<Document>(ArtifactsDir + u"Properties.Security.ReadOnlyEnforced.docx")->get_BuiltInDocumentProperties()->get_Security());
// Since this is still a descriptive property, we can protect a document and pick a suitable value ourselves
doc = MakeObject<Document>();
doc->get_BuiltInDocumentProperties()->set_Security(Aspose::Words::Properties::DocumentSecurity::ReadOnlyExceptAnnotations);
doc->Save(ArtifactsDir + u"Properties.Security.ReadOnlyExceptAnnotations.docx");
ASSERT_EQ(Aspose::Words::Properties::DocumentSecurity::ReadOnlyExceptAnnotations, MakeObject<Document>(ArtifactsDir + u"Properties.Security.ReadOnlyExceptAnnotations.docx")->get_BuiltInDocumentProperties()->get_Security());

◆ get_Subject()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_Subject ( )

Gets or sets the subject of the document.

Examples

Shows how to work with document properties in the "Description" category.

auto doc = MakeObject<Document>();
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Set the values of some descriptive properties
// These are metadata that can be glanced at without opening the document in the "Details" or "Content" folder views in Windows Explorer
// The "Details" view has columns dedicated to these properties
// Fields such as AUTHOR, SUBJECT, TITLE etc. can be used to display these values inside the document
properties->set_Author(u"John Doe");
properties->set_Title(u"John's Document");
properties->set_Subject(u"My subject");
properties->set_Category(u"My category");
properties->set_Comments(String::Format(u"This is {0}'s document about {1}",properties->get_Author(),properties->get_Subject()));
// Tags can be used as keywords and are separated by semicolons
properties->set_Keywords(u"Tag 1; Tag 2; Tag 3");
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Description
doc->Save(ArtifactsDir + u"Properties.Description.docx");

◆ get_Template()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_Template ( )

Gets or sets the informational name of the document template.

In Microsoft Word, this property is for informational purposes only and usually contains only the file name of the template without the path.

Empty string means the document is attached to the Normal template.

To get or set the actual name of the attached template, use the AttachedTemplate property.

See also
Aspose::Words::Document::get_AttachedTemplate
Examples

Shows how to work with document properties in the "Origin" category.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Since this document has been edited and printed in the past, values generated by Microsoft Word will appear here
// These values can be glanced at by right clicking the file in Windows Explorer, without actually opening the document
// Fields such as PRINTDATE, EDITTIME etc. can display these values inside the document
System::Console::WriteLine(String::Format(u"Created using {0}, on {1}",properties->get_NameOfApplication(),properties->get_CreatedTime()));
System::Console::WriteLine(String::Format(u"Minutes spent editing: {0}",properties->get_TotalEditingTime()));
System::Console::WriteLine(String::Format(u"Date/time last printed: {0}",properties->get_LastPrinted()));
System::Console::WriteLine(String::Format(u"Template document: {0}",properties->get_Template()));
// We can set these properties ourselves
properties->set_Company(u"Doe Ltd.");
properties->set_Manager(u"Jane Doe");
properties->set_Version(5);
properties->set_RevisionNumber(properties->get_RevisionNumber() + 1);
// If we plan on programmatically saving the document, we may record some details like this
properties->set_LastSavedBy(u"John Doe");
properties->set_LastSavedTime(System::DateTime::get_Now());
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Origin
doc->Save(ArtifactsDir + u"Properties.Origin.docx");

◆ get_Thumbnail()

System::ArrayPtr<uint8_t> Aspose::Words::Properties::BuiltInDocumentProperties::get_Thumbnail ( )

Gets or sets the thumbnail of the document.

For now this property is used only when a document is being exported to ePub, it's not read from and written to other document formats.

Image of arbitrary format can be set to this property, but the format is checked during export. InvalidOperationException is thrown if the image is invalid or its format is unsupported for specific format of document.

Only gif, jpeg and png images can be used for ePub publication.

Examples

Shows how to append a thumbnail to an Epub document.

// Create a blank document and add some text with a DocumentBuilder
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Writeln(u"Hello world!");
// The thumbnail property resides in a document's built in properties, but is used exclusively by Epub e-book documents
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Load an image from our file system into a byte array
ArrayPtr<uint8_t> thumbnailBytes = System::IO::File::ReadAllBytes(ImageDir + u"Logo.jpg");
// Set the value of the Thumbnail property to the array from above
properties->set_Thumbnail(thumbnailBytes);
// Our thumbnail should be visible at the start of the document, before the text we added
doc->Save(ArtifactsDir + u"Properties.Thumbnail.epub");
// We can also extract a thumbnail property into a byte array and then into the local file system like this
SharedPtr<DocumentProperty> thumbnail = doc->get_BuiltInDocumentProperties()->idx_get(u"Thumbnail");
System::IO::File::WriteAllBytes(ArtifactsDir + u"Properties.Thumbnail.gif", thumbnail->ToByteArray());

◆ get_Title()

System::String Aspose::Words::Properties::BuiltInDocumentProperties::get_Title ( )

Gets or sets the title of the document.

Examples

Shows how to work with document properties in the "Description" category.

auto doc = MakeObject<Document>();
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Set the values of some descriptive properties
// These are metadata that can be glanced at without opening the document in the "Details" or "Content" folder views in Windows Explorer
// The "Details" view has columns dedicated to these properties
// Fields such as AUTHOR, SUBJECT, TITLE etc. can be used to display these values inside the document
properties->set_Author(u"John Doe");
properties->set_Title(u"John's Document");
properties->set_Subject(u"My subject");
properties->set_Category(u"My category");
properties->set_Comments(String::Format(u"This is {0}'s document about {1}",properties->get_Author(),properties->get_Subject()));
// Tags can be used as keywords and are separated by semicolons
properties->set_Keywords(u"Tag 1; Tag 2; Tag 3");
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Description
doc->Save(ArtifactsDir + u"Properties.Description.docx");

◆ get_TitlesOfParts()

System::ArrayPtr<System::String> Aspose::Words::Properties::BuiltInDocumentProperties::get_TitlesOfParts ( )

Each string in the array specifies the name of a part in the document.

Aspose.Words does not update this property.

See also
Aspose::Words::Properties::BuiltInDocumentProperties::get_HeadingPairs
Examples

Shows the relationship between HeadingPairs and TitlesOfParts properties.

// Open a document that contains entries in the HeadingPairs/TitlesOfParts properties
auto doc = MakeObject<Document>(MyDir + u"Heading pairs and titles of parts.docx");
// We can find the combined values of these collections in File > Properties > Advanced Properties > Contents tab
// The HeadingPairs property is a collection of <string, int> pairs that determines
// how many document parts a heading spans over
ArrayPtr<SharedPtr<System::Object>> headingPairs = doc->get_BuiltInDocumentProperties()->get_HeadingPairs();
// The TitlesOfParts property contains the names of parts that belong to the above headings
ArrayPtr<String> titlesOfParts = doc->get_BuiltInDocumentProperties()->get_TitlesOfParts();
int headingPairsIndex = 0;
int titlesOfPartsIndex = 0;
while (headingPairsIndex < headingPairs->get_Length())
{
System::Console::WriteLine(String::Format(u"Parts for {0}:",headingPairs[headingPairsIndex++]));
int partsCount = System::Convert::ToInt32(headingPairs[headingPairsIndex++]);
for (int i = 0; i < partsCount; i++)
{
System::Console::WriteLine(String::Format(u"\t\"{0}\"",titlesOfParts[titlesOfPartsIndex++]));
}
}

◆ get_TotalEditingTime()

int32_t Aspose::Words::Properties::BuiltInDocumentProperties::get_TotalEditingTime ( )

Gets or sets the total editing time in minutes.

Examples

Shows how to work with document properties in the "Origin" category.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Since this document has been edited and printed in the past, values generated by Microsoft Word will appear here
// These values can be glanced at by right clicking the file in Windows Explorer, without actually opening the document
// Fields such as PRINTDATE, EDITTIME etc. can display these values inside the document
System::Console::WriteLine(String::Format(u"Created using {0}, on {1}",properties->get_NameOfApplication(),properties->get_CreatedTime()));
System::Console::WriteLine(String::Format(u"Minutes spent editing: {0}",properties->get_TotalEditingTime()));
System::Console::WriteLine(String::Format(u"Date/time last printed: {0}",properties->get_LastPrinted()));
System::Console::WriteLine(String::Format(u"Template document: {0}",properties->get_Template()));
// We can set these properties ourselves
properties->set_Company(u"Doe Ltd.");
properties->set_Manager(u"Jane Doe");
properties->set_Version(5);
properties->set_RevisionNumber(properties->get_RevisionNumber() + 1);
// If we plan on programmatically saving the document, we may record some details like this
properties->set_LastSavedBy(u"John Doe");
properties->set_LastSavedTime(System::DateTime::get_Now());
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Origin
doc->Save(ArtifactsDir + u"Properties.Origin.docx");

◆ get_Version()

int32_t Aspose::Words::Properties::BuiltInDocumentProperties::get_Version ( )

Represents the version number of the application that created the document.

When a document was created by Microsoft Word, then high 16 bit represent the major version and low 16 bit represent the build number.

Examples

Shows how to work with document properties in the "Origin" category.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// The properties we will work with are members of the BuiltInDocumentProperties attribute
SharedPtr<BuiltInDocumentProperties> properties = doc->get_BuiltInDocumentProperties();
// Since this document has been edited and printed in the past, values generated by Microsoft Word will appear here
// These values can be glanced at by right clicking the file in Windows Explorer, without actually opening the document
// Fields such as PRINTDATE, EDITTIME etc. can display these values inside the document
System::Console::WriteLine(String::Format(u"Created using {0}, on {1}",properties->get_NameOfApplication(),properties->get_CreatedTime()));
System::Console::WriteLine(String::Format(u"Minutes spent editing: {0}",properties->get_TotalEditingTime()));
System::Console::WriteLine(String::Format(u"Date/time last printed: {0}",properties->get_LastPrinted()));
System::Console::WriteLine(String::Format(u"Template document: {0}",properties->get_Template()));
// We can set these properties ourselves
properties->set_Company(u"Doe Ltd.");
properties->set_Manager(u"Jane Doe");
properties->set_Version(5);
properties->set_RevisionNumber(properties->get_RevisionNumber() + 1);
// If we plan on programmatically saving the document, we may record some details like this
properties->set_LastSavedBy(u"John Doe");
properties->set_LastSavedTime(System::DateTime::get_Now());
// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Origin
doc->Save(ArtifactsDir + u"Properties.Origin.docx");

◆ get_Words()

int32_t Aspose::Words::Properties::BuiltInDocumentProperties::get_Words ( )

Represents an estimate of the number of words in the document.

Aspose.Words updates this property when you call UpdateWordCount.

Examples

Shows how to update all list labels in a document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Add a paragraph of text to the document
builder->Writeln(String(u"Lorem ipsum dolor sit amet, consectetur adipiscing elit, ") + u"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
builder->Write(String(u"Ut enim ad minim veniam, ") + u"quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.");
// Document metrics are not tracked in code in real time
ASSERT_EQ(0, doc->get_BuiltInDocumentProperties()->get_Characters());
ASSERT_EQ(0, doc->get_BuiltInDocumentProperties()->get_Words());
ASSERT_EQ(1, doc->get_BuiltInDocumentProperties()->get_Paragraphs());
ASSERT_EQ(1, doc->get_BuiltInDocumentProperties()->get_Lines());
// We will need to call this method to update them
doc->UpdateWordCount();
// Check the values of the properties
ASSERT_EQ(196, doc->get_BuiltInDocumentProperties()->get_Characters());
ASSERT_EQ(36, doc->get_BuiltInDocumentProperties()->get_Words());
ASSERT_EQ(2, doc->get_BuiltInDocumentProperties()->get_Paragraphs());
ASSERT_EQ(1, doc->get_BuiltInDocumentProperties()->get_Lines());
// To also get the line count as it would appear in Microsoft Word,
// we will need to pass "true" to UpdateWordCount()
doc->UpdateWordCount(true);
ASSERT_EQ(4, doc->get_BuiltInDocumentProperties()->get_Lines());

◆ GetType()

virtual const System::TypeInfo& Aspose::Words::Properties::BuiltInDocumentProperties::GetType ( ) const
overridevirtual

◆ idx_get()

System::SharedPtr<Aspose::Words::Properties::DocumentProperty> Aspose::Words::Properties::BuiltInDocumentProperties::idx_get ( System::String  name)
overridevirtual

Returns a DocumentProperty object by the name of the property.

The string names of the properties correspond to the names of the typed properties available from BuiltInDocumentProperties.

If you request a property that is not present in the document, but the name of the property is recognized as a valid built-in name, a new DocumentProperty is created, added to the collection and returned. The newly created property is assigned a default value (empty string, zero, false or DateTime.MinValue depending on the type of the built-in property).

If you request a property that is not present in the document and the name is not recognized as a built-in name, a null is returned.

Parameters
nameThe case-insensitive name of the property to retrieve.
Examples

Shows how to work with custom document properties.

auto doc = MakeObject<Document>(MyDir + u"Properties.docx");
// A document's built in properties contains a set of predetermined keys
// with values such as the author's name or document's word count
// We can add our own keys and values to a custom properties collection also
// Before we add a custom property, we need to make sure that one with the same name doesn't already exist
ASSERT_EQ(u"Value of custom document property", System::ObjectExt::ToString(doc->get_CustomDocumentProperties()->idx_get(u"CustomProperty")));
doc->get_CustomDocumentProperties()->Add(u"CustomProperty2", String(u"Value of custom document property #2"));
// Iterate over all the custom document properties
System::Console::WriteLine(u"Custom Properties:");
for (auto customDocumentProperty : System::IterateOver(doc->get_CustomDocumentProperties()))
{
System::Console::WriteLine(customDocumentProperty->get_Name());
System::Console::WriteLine(String::Format(u"\tType:\t{0}",customDocumentProperty->get_Type()));
System::Console::WriteLine(String::Format(u"\tValue:\t\"{0}\"",customDocumentProperty->get_Value()));
}

Reimplemented from Aspose::Words::Properties::DocumentPropertyCollection.

◆ Is()

virtual bool Aspose::Words::Properties::BuiltInDocumentProperties::Is ( const System::TypeInfo target) const
overridevirtual

◆ set_Author()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Author ( System::String  value)

◆ set_Bytes()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Bytes ( int32_t  value)

◆ set_Category()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Category ( System::String  value)

◆ set_Characters()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Characters ( int32_t  value)

◆ set_CharactersWithSpaces()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_CharactersWithSpaces ( int32_t  value)

Represents an estimate of the number of characters (including spaces) in the document.

Aspose.Words updates this property when you call UpdateWordCount.

◆ set_Comments()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Comments ( System::String  value)

◆ set_Company()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Company ( System::String  value)

◆ set_ContentStatus()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_ContentStatus ( System::String  value)

Sets the ContentStatus of the document.

◆ set_ContentType()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_ContentType ( System::String  value)

Sets the ContentStatus of the document.

◆ set_CreatedTime()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_CreatedTime ( System::DateTime  value)

◆ set_HeadingPairs()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_HeadingPairs ( System::ArrayPtr< System::SharedPtr< System::Object >>  value)

◆ set_HyperlinkBase()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_HyperlinkBase ( System::String  value)

◆ set_Keywords()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Keywords ( System::String  value)

◆ set_LastPrinted()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_LastPrinted ( System::DateTime  value)

◆ set_LastSavedBy()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_LastSavedBy ( System::String  value)

◆ set_LastSavedTime()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_LastSavedTime ( System::DateTime  value)

◆ set_Lines()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Lines ( int32_t  value)

◆ set_LinksUpToDate()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_LinksUpToDate ( bool  value)

Indicates whether hyperlinks in a document are up-to-date.

Aspose.Words does not update this property.

◆ set_Manager()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Manager ( System::String  value)

◆ set_NameOfApplication()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_NameOfApplication ( System::String  value)

◆ set_Pages()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Pages ( int32_t  value)

Represents an estimate of the number of pages in the document.

Aspose.Words updates this property when you call UpdatePageLayout.

◆ set_Paragraphs()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Paragraphs ( int32_t  value)

◆ set_RevisionNumber()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_RevisionNumber ( int32_t  value)

◆ set_Security()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Security ( Aspose::Words::Properties::DocumentSecurity  value)

◆ set_Subject()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Subject ( System::String  value)

◆ set_Template()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Template ( System::String  value)

◆ set_Thumbnail()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Thumbnail ( System::ArrayPtr< uint8_t >  value)

◆ set_Title()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Title ( System::String  value)

◆ set_TitlesOfParts()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_TitlesOfParts ( System::ArrayPtr< System::String value)

◆ set_TotalEditingTime()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_TotalEditingTime ( int32_t  value)

◆ set_Version()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Version ( int32_t  value)

◆ set_Words()

void Aspose::Words::Properties::BuiltInDocumentProperties::set_Words ( int32_t  value)

◆ Type()

static const System::TypeInfo& Aspose::Words::Properties::BuiltInDocumentProperties::Type ( )
static
@ AllowOnlyComments
User can only modify comments in the document.
String
static String ToString(const char_t *obj)
@ None
There are no security states specified by the property.
static ASPOSECPP_SHARED_API void WriteAllBytes(const String &path, const ArrayPtr< uint8_t > &bytes)
static ASPOSECPP_SHARED_API DateTime get_Now()
std::enable_if< IsExceptionWrapper< TFrom >::value &&IsExceptionWrapper< TTo >::value &&(std::is_convertible< TTo, TFrom >::value||std::is_base_of< TTo, TFrom >::value), TTo >::type DynamicCast_noexcept(const TFrom &obj) noexcept
@ ReadOnlyEnforced
The document to always be opened read-only.
static ASPOSECPP_SHARED_API void WriteLine()
std::enable_if_t<!Details::IsIterable< Enumerable >::value, Details::EnumeratorAdapter< Enumerable, T > > IterateOver(System::SmartPtr< Enumerable > enumerable)
Aspose::Words::Properties::DocumentSecurity get_Security()
Specifies the security level of a document as a numeric value.
static ASPOSECPP_SHARED_API ArrayPtr< uint8_t > ReadAllBytes(const String &path)
static std::enable_if< std::is_convertible< T, Object >::value &&std::is_final< T >::value &&!System::IsBoxable< T >::value &&System::IsSmartPtr< U >::value, bool >::type Is(const U &obj)
@ ReadOnlyRecommended
The document to be opened read-only if possible, but the setting can be overridden.
static ASPOSECPP_SHARED_API bool Exists(const String &path)
static constexpr int ToInt32(bool value)
@ ReadOnlyExceptAnnotations
The document to always be opened read-only except for annotations.