1# Copyright (c) 2010-2024 openpyxl
2
3
4"""Constants for fixed paths in a file and xml namespace urls."""
5
6MIN_ROW = 0
7MIN_COLUMN = 0
8MAX_COLUMN = 16384
9MAX_ROW = 1048576
10
11# constants
12PACKAGE_PROPS = 'docProps'
13PACKAGE_XL = 'xl'
14PACKAGE_RELS = '_rels'
15PACKAGE_THEME = PACKAGE_XL + '/' + 'theme'
16PACKAGE_WORKSHEETS = PACKAGE_XL + '/' + 'worksheets'
17PACKAGE_CHARTSHEETS = PACKAGE_XL + '/' + 'chartsheets'
18PACKAGE_DRAWINGS = PACKAGE_XL + '/' + 'drawings'
19PACKAGE_CHARTS = PACKAGE_XL + '/' + 'charts'
20PACKAGE_IMAGES = PACKAGE_XL + '/' + 'media'
21PACKAGE_WORKSHEET_RELS = PACKAGE_WORKSHEETS + '/' + '_rels'
22PACKAGE_CHARTSHEETS_RELS = PACKAGE_CHARTSHEETS + '/' + '_rels'
23PACKAGE_PIVOT_TABLE = PACKAGE_XL + '/' + 'pivotTables'
24PACKAGE_PIVOT_CACHE = PACKAGE_XL + '/' + 'pivotCache'
25
26ARC_CONTENT_TYPES = '[Content_Types].xml'
27ARC_ROOT_RELS = PACKAGE_RELS + '/.rels'
28ARC_WORKBOOK_RELS = PACKAGE_XL + '/' + PACKAGE_RELS + '/workbook.xml.rels'
29ARC_CORE = PACKAGE_PROPS + '/core.xml'
30ARC_APP = PACKAGE_PROPS + '/app.xml'
31ARC_CUSTOM = PACKAGE_PROPS + '/custom.xml'
32ARC_WORKBOOK = PACKAGE_XL + '/workbook.xml'
33ARC_STYLE = PACKAGE_XL + '/styles.xml'
34ARC_THEME = PACKAGE_THEME + '/theme1.xml'
35ARC_SHARED_STRINGS = PACKAGE_XL + '/sharedStrings.xml'
36ARC_CUSTOM_UI = 'customUI/customUI.xml'
37
38## namespaces
39# XML
40XML_NS = "http://www.w3.org/XML/1998/namespace"
41# Dublin Core
42DCORE_NS = 'http://purl.org/dc/elements/1.1/'
43DCTERMS_NS = 'http://purl.org/dc/terms/'
44DCTERMS_PREFIX = 'dcterms'
45
46# Document
47DOC_NS = "http://schemas.openxmlformats.org/officeDocument/2006/"
48REL_NS = DOC_NS + "relationships"
49COMMENTS_NS = REL_NS + "/comments"
50IMAGE_NS = REL_NS + "/image"
51VML_NS = REL_NS + "/vmlDrawing"
52VTYPES_NS = DOC_NS + 'docPropsVTypes'
53XPROPS_NS = DOC_NS + 'extended-properties'
54CUSTPROPS_NS = DOC_NS + 'custom-properties'
55EXTERNAL_LINK_NS = REL_NS + "/externalLink"
56
57# CustomDocumentProperty FMTID:
58CPROPS_FMTID = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"
59
60# Package
61PKG_NS = "http://schemas.openxmlformats.org/package/2006/"
62PKG_REL_NS = PKG_NS + "relationships"
63COREPROPS_NS = PKG_NS + 'metadata/core-properties'
64CONTYPES_NS = PKG_NS + 'content-types'
65
66XSI_NS = 'http://www.w3.org/2001/XMLSchema-instance'
67XML_NS = 'http://www.w3.org/XML/1998/namespace'
68SHEET_MAIN_NS = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'
69
70# Drawing
71CHART_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart"
72DRAWING_NS = "http://schemas.openxmlformats.org/drawingml/2006/main"
73SHEET_DRAWING_NS = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
74CHART_DRAWING_NS = "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"
75
76CUSTOMUI_NS = 'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility'
77
78
79NAMESPACES = {
80 'cp': COREPROPS_NS,
81 'dc': DCORE_NS,
82 DCTERMS_PREFIX: DCTERMS_NS,
83 'dcmitype': 'http://purl.org/dc/dcmitype/',
84 'xsi': XSI_NS,
85 'vt': VTYPES_NS,
86 'xml': XML_NS,
87 'main': SHEET_MAIN_NS,
88 'cust': CUSTPROPS_NS,
89}
90
91## Mime types
92WORKBOOK_MACRO = "application/vnd.ms-excel.%s.macroEnabled.main+xml"
93WORKBOOK = "application/vnd.openxmlformats-officedocument.spreadsheetml.%s.main+xml"
94SPREADSHEET = "application/vnd.openxmlformats-officedocument.spreadsheetml.%s+xml"
95SHARED_STRINGS = SPREADSHEET % "sharedStrings"
96EXTERNAL_LINK = SPREADSHEET % "externalLink"
97WORKSHEET_TYPE = SPREADSHEET % "worksheet"
98COMMENTS_TYPE = SPREADSHEET % "comments"
99STYLES_TYPE = SPREADSHEET % "styles"
100CHARTSHEET_TYPE = SPREADSHEET % "chartsheet"
101DRAWING_TYPE = "application/vnd.openxmlformats-officedocument.drawing+xml"
102CHART_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml"
103CHARTSHAPE_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml"
104THEME_TYPE = "application/vnd.openxmlformats-officedocument.theme+xml"
105CPROPS_TYPE = "application/vnd.openxmlformats-officedocument.custom-properties+xml"
106XLTM = WORKBOOK_MACRO % 'template'
107XLSM = WORKBOOK_MACRO % 'sheet'
108XLTX = WORKBOOK % 'template'
109XLSX = WORKBOOK % 'sheet'
110
111
112# Extensions to the specification
113
114EXT_TYPES = {
115 '{78C0D931-6437-407D-A8EE-F0AAD7539E65}': 'Conditional Formatting',
116 '{CCE6A557-97BC-4B89-ADB6-D9C93CAAB3DF}': 'Data Validation',
117 '{05C60535-1F16-4FD2-B633-F4F36F0B64E0}': 'Sparkline Group',
118 '{A8765BA9-456A-4DAB-B4F3-ACF838C121DE}': 'Slicer List',
119 '{FC87AEE6-9EDD-4A0A-B7FB-166176984837}': 'Protected Range',
120 '{01252117-D84E-4E92-8308-4BE1C098FCBB}': 'Ignored Error',
121 '{F7C9EE02-42E1-4005-9D12-6889AFFD525C}': 'Web Extension',
122 '{3A4CF648-6AED-40f4-86FF-DC5316D8AED3}': 'Slicer List',
123 '{7E03D99C-DC04-49d9-9315-930204A7B6E9}': 'Timeline Ref',
124}
125
126# Objects related to macros that we preserve
127CTRL = "application/vnd.ms-excel.controlproperties+xml"
128ACTIVEX = "application/vnd.ms-office.activeX+xml"
129VBA = "application/vnd.ms-office.vbaProject"