sbi_special_docx_master.special_docx.AddDocx
- class sbi_special_docx_master.special_docx.AddDocx(doc, info)[source]
Class for working with specific blocks in a document. It adds textual and image information to a Document object.
Ensures that the original document is returned if an error occurs during modifications.
- Variables:
_orig_doc – DocxDocument - The original document.
info – dict - A dictionary containing information to be added.
_new_doc – Optional[DocxDocument] - The new document after modifications (if successful).
- Parameters:
doc (Document) –
info (Dict[str, List[Dict[str, Any]]]) –
- static _add_image_from_base64(base64_string, height, doc)[source]
Adds an image from a Base64 string to the document.
- Parameters:
base64_string (str) – The image string in Base64 format.
height (float) – The height of the image in inches.
doc (Document) –
- _add_info(info)[source]
Adds textual and image information to the document.
- Parameters:
info (List) – A list of dictionaries containing titles, content, and images.
- property document: Document
Returns the document instance with the required modifications, or the original document if the modified version could not be generated.
- property has_succeeded: bool
Returns True if the modified document was successfully created, or False if the document could not be generated.