Source code

Download source archive ↓

src/openpyxl/workbook/web.py

1# Copyright (c) 2010-2024 openpyxl
2
3from openpyxl.descriptors.serialisable import Serialisable
4from openpyxl.descriptors import (
5    Typed,
6    Sequence,
7    String,
8    Float,
9    Integer,
10    Bool,
11    NoneSet,
12)
13
14
15class WebPublishObject(Serialisable):
16
17    tagname = "webPublishingObject"
18
19    id = Integer()
20    divId = String()
21    sourceObject = String(allow_none=True)
22    destinationFile = String()
23    title = String(allow_none=True)
24    autoRepublish = Bool(allow_none=True)
25
26    def __init__(self,
27                 id=None,
28                 divId=None,
29                 sourceObject=None,
30                 destinationFile=None,
31                 title=None,
32                 autoRepublish=None,
33                ):
34        self.id = id
35        self.divId = divId
36        self.sourceObject = sourceObject
37        self.destinationFile = destinationFile
38        self.title = title
39        self.autoRepublish = autoRepublish
40
41
42class WebPublishObjectList(Serialisable):
43
44    tagname ="webPublishingObjects"
45
46    count = Integer(allow_none=True)
47    webPublishObject = Sequence(expected_type=WebPublishObject)
48
49    __elements__ = ('webPublishObject',)
50
51    def __init__(self,
52                 count=None,
53                 webPublishObject=(),
54                ):
55        self.webPublishObject = webPublishObject
56
57
58    @property
59    def count(self):
60        return len(self.webPublishObject)
61
62
63class WebPublishing(Serialisable):
64
65    tagname = "webPublishing"
66
67    css = Bool(allow_none=True)
68    thicket = Bool(allow_none=True)
69    longFileNames = Bool(allow_none=True)
70    vml = Bool(allow_none=True)
71    allowPng = Bool(allow_none=True)
72    targetScreenSize = NoneSet(values=(['544x376', '640x480', '720x512', '800x600',
73                                    '1024x768', '1152x882', '1152x900', '1280x1024', '1600x1200',
74                                    '1800x1440', '1920x1200']))
75    dpi = Integer(allow_none=True)
76    codePage = Integer(allow_none=True)
77    characterSet = String(allow_none=True)
78
79    def __init__(self,
80                 css=None,
81                 thicket=None,
82                 longFileNames=None,
83                 vml=None,
84                 allowPng=None,
85                 targetScreenSize='800x600',
86                 dpi=None,
87                 codePage=None,
88                 characterSet=None,
89                ):
90        self.css = css
91        self.thicket = thicket
92        self.longFileNames = longFileNames
93        self.vml = vml
94        self.allowPng = allowPng
95        self.targetScreenSize = targetScreenSize
96        self.dpi = dpi
97        self.codePage = codePage
98        self.characterSet = characterSet