Package Structure


NoMETA is a library for editing MS Office documents metadata, it works with documents of Office >= 2007 and has been tested with docx, pptx, xlsx, vsdx and accdt files.

Classes

class nometa.Document(file: str | IO[bytes], cls_core: Type[Core], cls_app: Type[App])

The Document class aggregates two sheets. One sheet represents the docProps/app.xml and the other one represents the docProps/core.xml

__init__(file: str | IO[bytes], cls_core: Type[Core], cls_app: Type[App]) None

Open the specified document to handle its metadata.

Parameters:
  • file (str | IO[bytes]) – file path of document as string OR an in-memory buffer (io.BytesIO)

  • cls_core (Type[Core]) – type of nometa.sheet.App class or its subclasses

  • cls_app (Type[App]) – type of nometa.sheet.Core class or its subclasses

Raises:
  • TypeError

  • ValueError

  • ValueError

property app: App

Get App sheet instance correponding to docProps/app.xml file.

Raises:

NotImplementedError – throws when there is no App instance.

Returns:

an instance of nometa.sheet.App

Return type:

App

property core: Core

Get Core sheet instance corresponding to docProps/core.xml file.

Returns:

an instance of nometa.sheet.Core

Return type:

Core

save(outfile: str | IO[bytes]) None

Save the changes to the specified document in outfile parameter.

Parameters:

outfile (str | IO[bytes]) – file path (as string) to document or in memory buffer (io.BytesIO)

Raises:

IOError – throws when input and output file path/buffer are the same