properties.py 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. from __future__ import absolute_import
  2. # Copyright (c) 2010-2019 openpyxl
  3. from openpyxl.descriptors.serialisable import Serialisable
  4. from openpyxl.descriptors import (
  5. String,
  6. Float,
  7. Integer,
  8. Bool,
  9. NoneSet,
  10. Set,
  11. )
  12. from openpyxl.descriptors.excel import Guid
  13. class WorkbookProperties(Serialisable):
  14. tagname = "workbookPr"
  15. date1904 = Bool(allow_none=True)
  16. dateCompatibility = Bool(allow_none=True)
  17. showObjects = NoneSet(values=(['all', 'placeholders']))
  18. showBorderUnselectedTables = Bool(allow_none=True)
  19. filterPrivacy = Bool(allow_none=True)
  20. promptedSolutions = Bool(allow_none=True)
  21. showInkAnnotation = Bool(allow_none=True)
  22. backupFile = Bool(allow_none=True)
  23. saveExternalLinkValues = Bool(allow_none=True)
  24. updateLinks = NoneSet(values=(['userSet', 'never', 'always']))
  25. codeName = String(allow_none=True)
  26. hidePivotFieldList = Bool(allow_none=True)
  27. showPivotChartFilter = Bool(allow_none=True)
  28. allowRefreshQuery = Bool(allow_none=True)
  29. publishItems = Bool(allow_none=True)
  30. checkCompatibility = Bool(allow_none=True)
  31. autoCompressPictures = Bool(allow_none=True)
  32. refreshAllConnections = Bool(allow_none=True)
  33. defaultThemeVersion = Integer(allow_none=True)
  34. def __init__(self,
  35. date1904=None,
  36. dateCompatibility=None,
  37. showObjects=None,
  38. showBorderUnselectedTables=None,
  39. filterPrivacy=None,
  40. promptedSolutions=None,
  41. showInkAnnotation=None,
  42. backupFile=None,
  43. saveExternalLinkValues=None,
  44. updateLinks=None,
  45. codeName=None,
  46. hidePivotFieldList=None,
  47. showPivotChartFilter=None,
  48. allowRefreshQuery=None,
  49. publishItems=None,
  50. checkCompatibility=None,
  51. autoCompressPictures=None,
  52. refreshAllConnections=None,
  53. defaultThemeVersion=None,
  54. ):
  55. self.date1904 = date1904
  56. self.dateCompatibility = dateCompatibility
  57. self.showObjects = showObjects
  58. self.showBorderUnselectedTables = showBorderUnselectedTables
  59. self.filterPrivacy = filterPrivacy
  60. self.promptedSolutions = promptedSolutions
  61. self.showInkAnnotation = showInkAnnotation
  62. self.backupFile = backupFile
  63. self.saveExternalLinkValues = saveExternalLinkValues
  64. self.updateLinks = updateLinks
  65. self.codeName = codeName
  66. self.hidePivotFieldList = hidePivotFieldList
  67. self.showPivotChartFilter = showPivotChartFilter
  68. self.allowRefreshQuery = allowRefreshQuery
  69. self.publishItems = publishItems
  70. self.checkCompatibility = checkCompatibility
  71. self.autoCompressPictures = autoCompressPictures
  72. self.refreshAllConnections = refreshAllConnections
  73. self.defaultThemeVersion = defaultThemeVersion
  74. class CalcProperties(Serialisable):
  75. tagname = "calcPr"
  76. calcId = Integer()
  77. calcMode = NoneSet(values=(['manual', 'auto', 'autoNoTable']))
  78. fullCalcOnLoad = Bool(allow_none=True)
  79. refMode = NoneSet(values=(['A1', 'R1C1']))
  80. iterate = Bool(allow_none=True)
  81. iterateCount = Integer(allow_none=True)
  82. iterateDelta = Float(allow_none=True)
  83. fullPrecision = Bool(allow_none=True)
  84. calcCompleted = Bool(allow_none=True)
  85. calcOnSave = Bool(allow_none=True)
  86. concurrentCalc = Bool(allow_none=True)
  87. concurrentManualCount = Integer(allow_none=True)
  88. forceFullCalc = Bool(allow_none=True)
  89. def __init__(self,
  90. calcId=124519,
  91. calcMode=None,
  92. fullCalcOnLoad=True,
  93. refMode=None,
  94. iterate=None,
  95. iterateCount=None,
  96. iterateDelta=None,
  97. fullPrecision=None,
  98. calcCompleted=None,
  99. calcOnSave=None,
  100. concurrentCalc=None,
  101. concurrentManualCount=None,
  102. forceFullCalc=None,
  103. ):
  104. self.calcId = calcId
  105. self.calcMode = calcMode
  106. self.fullCalcOnLoad = fullCalcOnLoad
  107. self.refMode = refMode
  108. self.iterate = iterate
  109. self.iterateCount = iterateCount
  110. self.iterateDelta = iterateDelta
  111. self.fullPrecision = fullPrecision
  112. self.calcCompleted = calcCompleted
  113. self.calcOnSave = calcOnSave
  114. self.concurrentCalc = concurrentCalc
  115. self.concurrentManualCount = concurrentManualCount
  116. self.forceFullCalc = forceFullCalc
  117. class FileVersion(Serialisable):
  118. tagname = "fileVersion"
  119. appName = String(allow_none=True)
  120. lastEdited = String(allow_none=True)
  121. lowestEdited = String(allow_none=True)
  122. rupBuild = String(allow_none=True)
  123. codeName = Guid(allow_none=True)
  124. def __init__(self,
  125. appName=None,
  126. lastEdited=None,
  127. lowestEdited=None,
  128. rupBuild=None,
  129. codeName=None,
  130. ):
  131. self.appName = appName
  132. self.lastEdited = lastEdited
  133. self.lowestEdited = lowestEdited
  134. self.rupBuild = rupBuild
  135. self.codeName = codeName