Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Commit

Permalink
complete report template
Browse files Browse the repository at this point in the history
  • Loading branch information
risufaj committed Jan 16, 2019
1 parent 50b2845 commit d21cf8e
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions request/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from fpdf import FPDF, HTMLMixin
from docx import Document
from docx.shared import Pt,Cm
from docx.enum.text import WD_BREAK

from common.views import (
CsrfExemptSessionAuthentication,
Expand Down Expand Up @@ -578,11 +579,22 @@ def add_table(document, header, data):
for row in table.rows:
row.height = Cm(0.7)
for cell in row.cells:
paragraphs = cell.paragraphs
for paragraph in paragraphs:
for run in paragraph.runs:
font = run.font
font.size = Pt(9)
if cell == row.cells[-1]:

paragraphs = cell.paragraphs
for paragraph in paragraphs:
for run in paragraph.runs:
if run == paragraph.runs[-1]:
run.add_break(WD_BREAK.PAGE)
font = run.font
font.size = Pt(9)
else:
paragraphs = cell.paragraphs
for paragraph in paragraphs:
for run in paragraph.runs:
font = run.font
font.size = Pt(9)


f_name = 'QC Complete Report.docx'
response = HttpResponse(content_type='application/vnd.openxmlformats' +
Expand Down

0 comments on commit d21cf8e

Please sign in to comment.