properties.py 5.1 KB

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