12
12
13
13
How to deal with block level style applied over table elements? e.g. text align
14
14
"""
15
+ import argparse
15
16
import enum
16
- import re , argparse
17
- import io , os
17
+ import io
18
+ import os
19
+ import re
18
20
import urllib .request
19
- from urllib .parse import urlparse
20
21
from html .parser import HTMLParser
22
+ from urllib .parse import urlparse
21
23
22
- import docx , docx .table
24
+ import docx
25
+ import docx .table
26
+ from bs4 import BeautifulSoup
23
27
from docx import Document
24
- from docx .shared import RGBColor , Pt , Inches
25
28
from docx .enum .text import WD_COLOR , WD_ALIGN_PARAGRAPH
26
29
from docx .oxml import OxmlElement
27
30
from docx .oxml .ns import qn
28
31
from docx .shared import Pt
29
-
30
- from bs4 import BeautifulSoup
32
+ from docx .shared import RGBColor , Inches
31
33
32
34
# values in inches
33
35
INDENT = 0.25
@@ -311,7 +313,7 @@ def add_image_to_cell(self, cell, image, width, height):
311
313
# python-docx doesn't have method yet for adding images to table cells. For now we use this
312
314
paragraph = cell .add_paragraph ()
313
315
run = paragraph .add_run ()
314
- run .add_picture (image ,width ,height )
316
+ run .add_picture (image , width , height )
315
317
316
318
def handle_img (self , current_attrs ):
317
319
if not self .include_images :
@@ -335,9 +337,9 @@ def handle_img(self, current_attrs):
335
337
if image :
336
338
try :
337
339
if isinstance (self .doc , docx .document .Document ):
338
- self .doc .add_picture (image ,width ,height )
340
+ self .doc .add_picture (image , width , height )
339
341
else :
340
- self .add_image_to_cell (self .doc , image ,width ,height )
342
+ self .add_image_to_cell (self .doc , image , width , height )
341
343
except FileNotFoundError :
342
344
image = None
343
345
if not image :
0 commit comments