mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-28 13:04:25 +00:00
Fix imports
Signed-off-by: SimJeg <sjegou@nvidia.com>
This commit is contained in:
parent
fbfb37f363
commit
01b4c12d3b
@ -20,6 +20,8 @@ from docx.oxml.table import CT_Tc
|
|||||||
from docx.oxml.xmlchemy import BaseOxmlElement
|
from docx.oxml.xmlchemy import BaseOxmlElement
|
||||||
from docx.table import Table, _Cell
|
from docx.table import Table, _Cell
|
||||||
from docx.text.paragraph import Paragraph
|
from docx.text.paragraph import Paragraph
|
||||||
|
from docx.text.run import Run
|
||||||
|
from docx.text.hyperlink import Hyperlink
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
from lxml.etree import XPath
|
from lxml.etree import XPath
|
||||||
from PIL import Image, UnidentifiedImageError
|
from PIL import Image, UnidentifiedImageError
|
||||||
@ -294,10 +296,10 @@ class MsWordDocumentBackend(DeclarativeDocumentBackend):
|
|||||||
|
|
||||||
# Iterate over the runs of the paragraph and group them by style
|
# Iterate over the runs of the paragraph and group them by style
|
||||||
for c in paragraph.iter_inner_content():
|
for c in paragraph.iter_inner_content():
|
||||||
if isinstance(c, docx.text.hyperlink.Hyperlink):
|
if isinstance(c, Hyperlink):
|
||||||
text = f"[{c.text}]({c.address})"
|
text = f"[{c.text}]({c.address})"
|
||||||
style = (c.runs[0].bold, c.runs[0].italic, c.runs[0].underline)
|
style = (c.runs[0].bold, c.runs[0].italic, c.runs[0].underline)
|
||||||
elif isinstance(c, docx.text.run.Run):
|
elif isinstance(c, Run):
|
||||||
text = c.text
|
text = c.text
|
||||||
style = (c.bold, c.italic, c.underline)
|
style = (c.bold, c.italic, c.underline)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user