viktor.external.word
WordFileComponent
- class viktor.external.word.WordFileComponent(identifier)¶
Bases:
ABC
Abstract base class for specific word file components, such as tags, images…
WordFileTag
- class viktor.external.word.WordFileTag(identifier, value)¶
Bases:
WordFileComponent
Add a value in a Word file template by tag.
- Parameters
identifier (
str
) – used to find the location in the templatevalue (
object
) – what needs to be placed at tag location
WordFileImage
- class viktor.external.word.WordFileImage(file, identifier, width=None, height=None)¶
Bases:
WordFileComponent
Add an image in a Word file template. When neither width or height is provided, the original size is used. When only one is provided, the other is scaled. When both are provided, both are used and the original aspect ratio might be changed.
- Parameters
file (
BinaryIO
) – image to be placed at the tag locationidentifier (
str
) – used to find the location in the templatewidth (
int
) – optional parameter for sizing. in Ptheight (
int
) – optional parameter for sizing. in Pt
- classmethod from_path(file_path, identifier, width=None, height=None)¶
Create a WordFileImage from an image defined by its file path.
- Return type
WordFileResult
- class viktor.external.word.WordFileResult(*, file_content=None)¶