bytes containing the content of the file to be attached.
source_full_name
str
str full name of the attached file (the extension is used to determine the appropriate application to open the file).
preview_image_content
list[int]
bytes preview image of the attached file as a byte array.
x
float
int x‑coordinate of the attachment frame (in points).
y
float
int y‑coordinate of the attachment frame (in points).
width
float
int width of the attachment frame (in points).
height
float
int height of the attachment frame (in points).
Returns: None.
Example
fromgroupdocs.watermarkimportWatermarkerfromgroupdocs.watermark.options.spreadsheetimportSpreadsheetLoadOptionsdefadd_attachment():withWatermarker("./sample.xlsx",SpreadsheetLoadOptions())aswatermarker:content=watermarker.get_content()withopen("./sample.docx","rb")asf:data=f.read()withopen("./preview.png","rb")asf:preview=f.read()# Embed the file in the first worksheet, shown as its preview image# at x=50, y=20 with a 100 x 120 framecontent.worksheets[0].attachments.add_attachment(data,"sample.docx",preview,50,20,100,120)watermarker.save("./output.xlsx")if__name__=="__main__":add_attachment()