File size: 999 Bytes
54b3a40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import streamlit as st
from docx import Document
from docx.shared import Inches
from docxtpl import DocxTemplate, InlineImage
from docx.shared import Mm, Inches
import datetime
import io

document = Document()

document.add_heading('Document Title', 0)

p = document.add_paragraph('A plain paragraph having some ')
p.add_run('bold').bold = True
p.add_run(' and some ')
p.add_run('italic.').italic = True

document.add_heading('Heading, level 1', level=1)
document.add_paragraph('Intense quote', style='Intense Quote')

# Create in-memory buffer
file_stream = io.BytesIO()
# Save the .docx to the buffer
document.save(file_stream)
# Reset the buffer's file-pointer to the beginning of the file
file_stream.seek(0)


st.download_button(
    label="Download report here",
    data=file_stream,
    file_name="SEAO Fold 4_Flip 4 Quality Monitoring (" + datetime.datetime.now().strftime("%#d %b") + ").docx",
    mime='application/vnd.openxmlformats-officedocument.wordprocessingml.document',
    )