-
Notifications
You must be signed in to change notification settings - Fork 0
/
excel_input.py
43 lines (37 loc) · 1.45 KB
/
excel_input.py
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
from .input_type import InputType
from .page_size import PageSize
from .page_orientation import PageOrientation
from .converter_input import ConverterInput
class ExcelInput(ConverterInput):
'''
Represents a Excel input.
'''
def __init__(self, resource, size = PageSize.Letter, orientation = PageOrientation.Portrait, margins = None):
'''
Initializes a new instance of the ExcelInput class.
Args:
resource (ExcelResource): The resource of type ExcelResource.
size (PageSize): The page size of the output PDF.
orientation (PageOrientation): The page orientation of the output PDF.
margins (float): The page margins of the output PDF.
'''
super().__init__(resource, size, orientation, margins)
self._type = InputType.Excel
def to_json(self):
json = {
"id":self.id,
"resourceName": self.resource_name,
"templateId": self._template_id,
"type": self._type,
"pageWidth": self.page_width,
"pageHeight": self.page_height,
}
if self.top_margin:
json["topMargin"] = self.top_margin
if self.left_margin:
json["leftMargin"] = self.left_margin
if self.bottom_margin:
json["bottomMargin"] = self.bottom_margin
if self.right_margin:
json["rightMargin"] = self.right_margin
return json