Module doc_factory

ooodev.utils.factory.doc_factory.doc_factory(doc, lo_inst)[source]

Gets an instance of a document.

Parameters:
  • doc (Any) – Office document such as Writer, Calc, Draw, Impress.

  • lo_inst (LoInst) – Lo Instance. Can be Lo.current_lo.

Raises:
  • ValueError – If no identifier found.

  • ValueError – If unknown identifier.

Returns:

A document instance. Such as ooodev.draw.DrawDoc or ooodev.calc.CalcDoc.

Return type:

OfficeDocumentT

ooodev.utils.factory.doc_factory.is_known_doc(doc, lo_inst)[source]

Checks if the document is known.

Parameters:
  • doc (Any) – Office document such as Writer, Calc, Draw, Impress.

  • lo_inst (LoInst) – Lo Instance. Can be Lo.current_lo.

Returns:

True if known, False otherwise.

Return type:

bool