This repository was archived by the owner on May 6, 2025. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathtextbox.py
More file actions
67 lines (56 loc) · 2.02 KB
/
Copy pathtextbox.py
File metadata and controls
67 lines (56 loc) · 2.02 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from .oxml.textbox import GroupBaseOxmlElement
from .shared import Parented
from .text.paragraph import Paragraph
class TextboxContent(Parented):
"""
Proxy class for a WordprocessingML ``<w:txbxContent>`` element.
"""
def __init__(self, txbxContent, parent):
super(TextboxContent, self).__init__(parent)
self._element = self._txbxContent = txbxContent
@property
def paragraphs(self):
"""
|Paragraph| instance containing the sequence of paragraphs in this textbox.
"""
return [Paragraph(p, self) for p in self._txbxContent.p_lst]
@property
def has_warp(self):
return self._txbxContent.shape.has_wrap
@property
def off_x(self):
if isinstance(self._txbxContent.shape, GroupBaseOxmlElement):
return self._txbxContent.off_x
return 0
@property
def off_y(self):
if isinstance(self._txbxContent.shape, GroupBaseOxmlElement):
return self._txbxContent.off_y
return 0
@property
def width(self):
if isinstance(self._txbxContent.shape, GroupBaseOxmlElement):
return self._txbxContent.width
return self.part.document.sections[0].page_width.pt
@property
def height(self):
if isinstance(self._txbxContent.shape, GroupBaseOxmlElement):
return self._txbxContent.height
return 0
@property
def vertical_relative_from(self):
if isinstance(self._txbxContent.shape, GroupBaseOxmlElement):
return self._txbxContent.shape.mso_position_vertical_relative
else:
return "paragraph"
@property
def horizontal_relative_from(self):
if isinstance(self._txbxContent.shape, GroupBaseOxmlElement):
return self._txbxContent.shape.mso_position_horizontal_relative
else:
return "paragraph"
@property
def fillcolor(self):
if isinstance(self._txbxContent.shape, GroupBaseOxmlElement):
return self._txbxContent.shape.fillcolor
return None