opc.coreprops module#

class opc.coreprops.CoreProperties(part)[source]#

Object of this class is a collection of Package core properties

Supported properties are below:
  • title

  • subject

  • author

  • keywords

  • comments

  • last author

  • revision number

  • last print date

  • creation date

  • last save time

  • category

  • content status

Of above following are datetime related properties others are strings
  • last print date

  • creation date

  • last save time

Example:

from datetime import datetime
dt_now = datetime.now().astimezone()
<core_properties>.Item('creation date').Value = dt_now
<core_properties>.Item('author').Value = "New Author"
Item(prop)[source]#

returns the PropertyItem object from the given property name

type = 'application/vnd.openxmlformats-package.core-properties+xml'#
class opc.coreprops.PropertyItem(parent, name)[source]#

class of property items of core property objects

PropertyItem.dt_props are the datetime value properties. Others are string value properties

Parameters:
  • parentCoreProperties object. Needed to access the xml

  • name – name of the property

property Value#

Value of the property item

Getter:

Returns the value

Setter:

Sets the value

Type:

datetime.datetime for datetime related property, str for others

Example:

from datetime import datetime
dt_now = datetime.now().astimezone()
<core_properties>.Item('creation date').Value = dt_now
<core_properties>.Item('author').Value = "New Author"
dt_props = ['last print date', 'creation date', 'last save time']#

properties that are datetime related

property e#

Returns the xml element of the property item

property pfxname#

Returns the prefix name of the property item eg. ‘dc:title’