views.py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. # Copyright (c) 2010-2024 openpyxl
  2. from openpyxl.descriptors.serialisable import Serialisable
  3. from openpyxl.descriptors import (
  4. Typed,
  5. Sequence,
  6. String,
  7. Float,
  8. Integer,
  9. Bool,
  10. NoneSet,
  11. Set,
  12. )
  13. from openpyxl.descriptors.excel import (
  14. ExtensionList,
  15. Guid,
  16. )
  17. class BookView(Serialisable):
  18. tagname = "workbookView"
  19. visibility = NoneSet(values=(['visible', 'hidden', 'veryHidden']))
  20. minimized = Bool(allow_none=True)
  21. showHorizontalScroll = Bool(allow_none=True)
  22. showVerticalScroll = Bool(allow_none=True)
  23. showSheetTabs = Bool(allow_none=True)
  24. xWindow = Integer(allow_none=True)
  25. yWindow = Integer(allow_none=True)
  26. windowWidth = Integer(allow_none=True)
  27. windowHeight = Integer(allow_none=True)
  28. tabRatio = Integer(allow_none=True)
  29. firstSheet = Integer(allow_none=True)
  30. activeTab = Integer(allow_none=True)
  31. autoFilterDateGrouping = Bool(allow_none=True)
  32. extLst = Typed(expected_type=ExtensionList, allow_none=True)
  33. __elements__ = ()
  34. def __init__(self,
  35. visibility="visible",
  36. minimized=False,
  37. showHorizontalScroll=True,
  38. showVerticalScroll=True,
  39. showSheetTabs=True,
  40. xWindow=None,
  41. yWindow=None,
  42. windowWidth=None,
  43. windowHeight=None,
  44. tabRatio=600,
  45. firstSheet=0,
  46. activeTab=0,
  47. autoFilterDateGrouping=True,
  48. extLst=None,
  49. ):
  50. self.visibility = visibility
  51. self.minimized = minimized
  52. self.showHorizontalScroll = showHorizontalScroll
  53. self.showVerticalScroll = showVerticalScroll
  54. self.showSheetTabs = showSheetTabs
  55. self.xWindow = xWindow
  56. self.yWindow = yWindow
  57. self.windowWidth = windowWidth
  58. self.windowHeight = windowHeight
  59. self.tabRatio = tabRatio
  60. self.firstSheet = firstSheet
  61. self.activeTab = activeTab
  62. self.autoFilterDateGrouping = autoFilterDateGrouping
  63. class CustomWorkbookView(Serialisable):
  64. tagname = "customWorkbookView"
  65. name = String()
  66. guid = Guid()
  67. autoUpdate = Bool(allow_none=True)
  68. mergeInterval = Integer(allow_none=True)
  69. changesSavedWin = Bool(allow_none=True)
  70. onlySync = Bool(allow_none=True)
  71. personalView = Bool(allow_none=True)
  72. includePrintSettings = Bool(allow_none=True)
  73. includeHiddenRowCol = Bool(allow_none=True)
  74. maximized = Bool(allow_none=True)
  75. minimized = Bool(allow_none=True)
  76. showHorizontalScroll = Bool(allow_none=True)
  77. showVerticalScroll = Bool(allow_none=True)
  78. showSheetTabs = Bool(allow_none=True)
  79. xWindow = Integer(allow_none=True)
  80. yWindow = Integer(allow_none=True)
  81. windowWidth = Integer()
  82. windowHeight = Integer()
  83. tabRatio = Integer(allow_none=True)
  84. activeSheetId = Integer()
  85. showFormulaBar = Bool(allow_none=True)
  86. showStatusbar = Bool(allow_none=True)
  87. showComments = NoneSet(values=(['commNone', 'commIndicator',
  88. 'commIndAndComment']))
  89. showObjects = NoneSet(values=(['all', 'placeholders']))
  90. extLst = Typed(expected_type=ExtensionList, allow_none=True)
  91. __elements__ = ()
  92. def __init__(self,
  93. name=None,
  94. guid=None,
  95. autoUpdate=None,
  96. mergeInterval=None,
  97. changesSavedWin=None,
  98. onlySync=None,
  99. personalView=None,
  100. includePrintSettings=None,
  101. includeHiddenRowCol=None,
  102. maximized=None,
  103. minimized=None,
  104. showHorizontalScroll=None,
  105. showVerticalScroll=None,
  106. showSheetTabs=None,
  107. xWindow=None,
  108. yWindow=None,
  109. windowWidth=None,
  110. windowHeight=None,
  111. tabRatio=None,
  112. activeSheetId=None,
  113. showFormulaBar=None,
  114. showStatusbar=None,
  115. showComments="commIndicator",
  116. showObjects="all",
  117. extLst=None,
  118. ):
  119. self.name = name
  120. self.guid = guid
  121. self.autoUpdate = autoUpdate
  122. self.mergeInterval = mergeInterval
  123. self.changesSavedWin = changesSavedWin
  124. self.onlySync = onlySync
  125. self.personalView = personalView
  126. self.includePrintSettings = includePrintSettings
  127. self.includeHiddenRowCol = includeHiddenRowCol
  128. self.maximized = maximized
  129. self.minimized = minimized
  130. self.showHorizontalScroll = showHorizontalScroll
  131. self.showVerticalScroll = showVerticalScroll
  132. self.showSheetTabs = showSheetTabs
  133. self.xWindow = xWindow
  134. self.yWindow = yWindow
  135. self.windowWidth = windowWidth
  136. self.windowHeight = windowHeight
  137. self.tabRatio = tabRatio
  138. self.activeSheetId = activeSheetId
  139. self.showFormulaBar = showFormulaBar
  140. self.showStatusbar = showStatusbar
  141. self.showComments = showComments
  142. self.showObjects = showObjects