class SortCondition(Serialisable): tagname = "sortCondition" descending = Bool(allow_none=True) sortBy = NoneSet(values=(['value', 'cellColor', 'fontColor', 'icon'])) ref = CellRange() customList = String(allow_none=True) dxfId = Integer(allow_none=True) iconSet = NoneSet(values=([ '3Arrows', '3ArrowsGray', '3Flags', '3TrafficLights1', '3TrafficLights2', '3Signs', '3Symbols', '3Symbols2', '4Arrows', '4ArrowsGray', '4RedToBlack', '4Rating', '4TrafficLights', '5Arrows', '5ArrowsGray', '5Rating', '5Quarters' ])) iconId = Integer(allow_none=True) def __init__( self, ref=None, descending=None, sortBy=None, customList=None, dxfId=None, iconSet=None, iconId=None, ): self.descending = descending self.sortBy = sortBy self.ref = ref self.customList = customList self.dxfId = dxfId self.iconSet = iconSet self.iconId = iconId
class Alignment(HashableObject): """Alignment options for use in styles.""" tagname = "alignment" __fields__ = ('horizontal', 'vertical', 'textRotation', 'wrapText', 'shrinkToFit', 'indent', 'relativeIndent', 'justifyLastLine', 'readingOrder', ) horizontal = NoneSet(values=horizontal_alignments) vertical = NoneSet(values=vertical_aligments) textRotation = NoneSet(values=range(181)) textRotation.values.add(255) text_rotation = Alias('textRotation') wrapText = Bool(allow_none=True) wrap_text = Alias('wrapText') shrinkToFit = Bool(allow_none=True) shrink_to_fit = Alias('shrinkToFit') indent = Min(min=0) relativeIndent = Min(min=0) justifyLastLine = Bool(allow_none=True) readingOrder = Min(min=0) def __init__(self, horizontal=None, vertical=None, textRotation=0, wrapText=None, shrinkToFit=None, indent=0, relativeIndent=0, justifyLastLine=None, readingOrder=0, text_rotation=None, wrap_text=None, shrink_to_fit=None) : self.horizontal = horizontal self.vertical = vertical self.indent = indent self.relativeIndent = relativeIndent self.justifyLastLine = justifyLastLine self.readingOrder = readingOrder if text_rotation is not None: textRotation = text_rotation if textRotation is not None: self.textRotation = int(textRotation) if wrap_text is not None: wrapText = wrap_text self.wrapText = wrapText if shrink_to_fit is not None: shrinkToFit = shrink_to_fit self.shrinkToFit = shrinkToFit def __iter__(self): for attr in self.__attrs__: value = getattr(self, attr) if value is not None and value != 0: yield attr, safe_string(value)
class PivotArea(Serialisable): tagname = "pivotArea" references = NestedSequence(expected_type=Reference, count=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) field = Integer(allow_none=True) type = NoneSet(values=( ['normal', 'data', 'all', 'origin', 'button', 'topEnd', 'topRight'])) dataOnly = Bool(allow_none=True) labelOnly = Bool(allow_none=True) grandRow = Bool(allow_none=True) grandCol = Bool(allow_none=True) cacheIndex = Bool(allow_none=True) outline = Bool(allow_none=True) offset = String(allow_none=True) collapsedLevelsAreSubtotals = Bool(allow_none=True) axis = NoneSet(values=(['axisRow', 'axisCol', 'axisPage', 'axisValues'])) fieldPosition = Integer(allow_none=True) __elements__ = ('references', ) def __init__( self, references=(), extLst=None, field=None, type="normal", dataOnly=True, labelOnly=None, grandRow=None, grandCol=None, cacheIndex=None, outline=True, offset=None, collapsedLevelsAreSubtotals=None, axis=None, fieldPosition=None, ): self.references = references self.extLst = extLst self.field = field self.type = type self.dataOnly = dataOnly self.labelOnly = labelOnly self.grandRow = grandRow self.grandCol = grandCol self.cacheIndex = cacheIndex self.outline = outline self.offset = offset self.collapsedLevelsAreSubtotals = collapsedLevelsAreSubtotals self.axis = axis self.fieldPosition = fieldPosition
class TwoCellAnchor(_AnchorBase): tagname = "twoCellAnchor" editAs = NoneSet(values=(['twoCell', 'oneCell', 'absolute'])) _from = Typed(expected_type=AnchorMarker) to = Typed(expected_type=AnchorMarker) sp = _AnchorBase.sp grpSp = _AnchorBase.grpSp graphicFrame = _AnchorBase.graphicFrame cxnSp = _AnchorBase.cxnSp pic = _AnchorBase.pic contentPart = _AnchorBase.contentPart clientData = _AnchorBase.clientData __elements__ = ('_from', 'to') + _AnchorBase.__elements__ def __init__(self, editAs=None, _from=None, to=None, **kw): self.editAs = editAs if _from is None: _from = AnchorMarker() self._from = _from if to is None: to = AnchorMarker() self.to = to super(TwoCellAnchor, self).__init__(**kw)
class PatternFillProperties(Serialisable): tagname = "pattFill" namespace = DRAWING_NS prst = NoneSet(values=([ 'pct5', 'pct10', 'pct20', 'pct25', 'pct30', 'pct40', 'pct50', 'pct60', 'pct70', 'pct75', 'pct80', 'pct90', 'horz', 'vert', 'ltHorz', 'ltVert', 'dkHorz', 'dkVert', 'narHorz', 'narVert', 'dashHorz', 'dashVert', 'cross', 'dnDiag', 'upDiag', 'ltDnDiag', 'ltUpDiag', 'dkDnDiag', 'dkUpDiag', 'wdDnDiag', 'wdUpDiag', 'dashDnDiag', 'dashUpDiag', 'diagCross', 'smCheck', 'lgCheck', 'smGrid', 'lgGrid', 'dotGrid', 'smConfetti', 'lgConfetti', 'horzBrick', 'diagBrick', 'solidDmnd', 'openDmnd', 'dotDmnd', 'plaid', 'sphere', 'weave', 'divot', 'shingle', 'wave', 'trellis', 'zigZag' ])) preset = Alias("prst") fgClr = Typed(expected_type=ColorChoice, allow_none=True) foreground = Alias("fgClr") bgClr = Typed(expected_type=ColorChoice, allow_none=True) background = Alias("bgClr") __elements__ = ("fgClr", "bgClr") def __init__( self, prst=None, fgClr=None, bgClr=None, ): self.prst = prst self.fgClr = fgClr self.bgClr = bgClr
class ConditionalFormat(Serialisable): tagname = "conditionalFormat" scope = Set(values=(['selection', 'data', 'field'])) type = NoneSet(values=(['all', 'row', 'column'])) priority = Integer() pivotAreas = NestedSequence(expected_type=PivotArea) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('pivotAreas', ) def __init__( self, scope=None, type=None, priority=None, pivotAreas=(), extLst=None, ): self.scope = scope self.type = type self.priority = priority self.pivotAreas = pivotAreas self.extLst = extLst
class Filters(Serialisable): tagname = "filters" blank = Bool(allow_none=True) calendarType = NoneSet(values=[ "gregorian", "gregorianUs", "gregorianMeFrench", "gregorianArabic", "hijri", "hebrew", "taiwan", "japan", "thai", "korea", "saka", "gregorianXlitEnglish", "gregorianXlitFrench" ]) filter = ValueSequence(expected_type=unicode) dateGroupItem = Sequence(expected_type=DateGroupItem, allow_none=True) __elements__ = ('filter', 'dateGroupItem') def __init__( self, blank=None, calendarType=None, filter=(), dateGroupItem=(), ): self.blank = blank self.calendarType = calendarType self.filter = filter self.dateGroupItem = dateGroupItem
class IconSet(RuleType): tagname = "iconSet" iconSet = NoneSet(values=(['3Arrows', '3ArrowsGray', '3Flags', '3TrafficLights1', '3TrafficLights2', '3Signs', '3Symbols', '3Symbols2', '4Arrows', '4ArrowsGray', '4RedToBlack', '4Rating', '4TrafficLights', '5Arrows', '5ArrowsGray', '5Rating', '5Quarters'])) showValue = Bool(allow_none=True) percent = Bool(allow_none=True) reverse = Bool(allow_none=True) __elements__ = ("cfvo",) def __init__(self, iconSet=None, showValue=None, percent=None, reverse=None, cfvo=None, ): self.iconSet = iconSet self.showValue = showValue self.percent = percent self.reverse = reverse self.cfvo = cfvo
class OLAPSet(Serialisable): tagname = "set" count = Integer() maxRank = Integer() setDefinition = String() sortType = NoneSet(values=([ 'ascending', 'descending', 'ascendingAlpha', 'descendingAlpha', 'ascendingNatural', 'descendingNatural' ])) queryFailed = Bool() tpls = Typed(expected_type=TupleList, allow_none=True) sortByTuple = Typed(expected_type=TupleList, allow_none=True) __elements__ = ('tpls', 'sortByTuple') def __init__( self, count=None, maxRank=None, setDefinition=None, sortType=None, queryFailed=None, tpls=None, sortByTuple=None, ): self.count = count self.maxRank = maxRank self.setDefinition = setDefinition self.sortType = sortType self.queryFailed = queryFailed self.tpls = tpls self.sortByTuple = sortByTuple
class SortState(Serialisable): tagname = "sortState" columnSort = Bool(allow_none=True) caseSensitive = Bool(allow_none=True) sortMethod = NoneSet(values=(['stroke', 'pinYin'])) ref = CellRange() sortCondition = Sequence(expected_type=SortCondition, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('sortCondition', ) def __init__( self, columnSort=None, caseSensitive=None, sortMethod=None, ref=None, sortCondition=(), extLst=None, ): self.columnSort = columnSort self.caseSensitive = caseSensitive self.sortMethod = sortMethod self.ref = ref self.sortCondition = sortCondition def __bool__(self): return self.ref is not None __nonzero__ = __bool__
class ChildSheet(Serialisable): """ Represents a reference to a worksheet or chartsheet in workbook.xml It contains the title, order and state but only an indirect reference to the objects themselves. """ tagname = "sheet" name = String() sheetId = Integer() state = NoneSet(values=(['visible', 'hidden', 'veryHidden'])) id = Relation() def __init__( self, name=None, sheetId=None, state="visible", id=None, ): self.name = name self.sheetId = sheetId self.state = state self.id = id
class GradientFillProperties(Serialisable): tagname = "gradFill" namespace = DRAWING_NS flip = NoneSet(values=(['x', 'y', 'xy'])) rotWithShape = Bool(allow_none=True) gsLst = NestedSequence(expected_type=GradientStop, count=False) stop_list = Alias("gsLst") lin = Typed(expected_type=LinearShadeProperties, allow_none=True) linear = Alias("lin") path = Typed(expected_type=PathShadeProperties, allow_none=True) tileRect = Typed(expected_type=RelativeRect, allow_none=True) __elements__ = ('gsLst', 'lin', 'path', 'tileRect') def __init__( self, flip=None, rotWithShape=None, gsLst=(), lin=None, path=None, tileRect=None, ): self.flip = flip self.rotWithShape = rotWithShape self.gsLst = gsLst self.lin = lin self.path = path self.tileRect = tileRect
class PatternFill(Fill): """Area fill patterns for use in styles. Caution: if you do not specify a fill_type, other attributes will have no effect !""" spec = """18.8.32""" __fields__ = ('patternType', 'fgColor', 'bgColor') patternType = NoneSet(values=fills) fill_type = Alias("patternType") fgColor = ColorDescriptor() start_color = Alias("fgColor") bgColor = ColorDescriptor() end_color = Alias("bgColor") def __init__(self, patternType=None, fgColor=Color(), bgColor=Color(), fill_type=None, start_color=None, end_color=None): if fill_type is not None: patternType = fill_type self.patternType = patternType if start_color is not None: fgColor = start_color self.fgColor = fgColor if end_color is not None: bgColor = end_color self.bgColor = bgColor
class CalcProperties(Serialisable): tagname = "calcPr" calcId = Integer() calcMode = NoneSet(values=(['manual', 'auto', 'autoNoTable'])) fullCalcOnLoad = Bool(allow_none=True) refMode = NoneSet(values=(['A1', 'R1C1'])) iterate = Bool(allow_none=True) iterateCount = Integer(allow_none=True) iterateDelta = Float(allow_none=True) fullPrecision = Bool(allow_none=True) calcCompleted = Bool(allow_none=True) calcOnSave = Bool(allow_none=True) concurrentCalc = Bool(allow_none=True) concurrentManualCount = Integer(allow_none=True) forceFullCalc = Bool(allow_none=True) def __init__( self, calcId=124519, calcMode=None, fullCalcOnLoad=True, refMode=None, iterate=None, iterateCount=None, iterateDelta=None, fullPrecision=None, calcCompleted=None, calcOnSave=None, concurrentCalc=None, concurrentManualCount=None, forceFullCalc=None, ): self.calcId = calcId self.calcMode = calcMode self.fullCalcOnLoad = fullCalcOnLoad self.refMode = refMode self.iterate = iterate self.iterateCount = iterateCount self.iterateDelta = iterateDelta self.fullPrecision = fullPrecision self.calcCompleted = calcCompleted self.calcOnSave = calcOnSave self.concurrentCalc = concurrentCalc self.concurrentManualCount = concurrentManualCount self.forceFullCalc = forceFullCalc
class PhoneticProperties(Serialisable): tagname = "phoneticPr" fontId = Integer() type = NoneSet(values=(['halfwidthKatakana', 'fullwidthKatakana', 'Hiragana', 'noConversion'])) alignment = NoneSet(values=(['noControl', 'left', 'center', 'distributed'])) def __init__(self, fontId=None, type=None, alignment=None, ): self.fontId = fontId self.type = type self.alignment = alignment
class LineEndProperties(Serialisable): tagname = "end" namespace = DRAWING_NS type = NoneSet(values=(['none', 'triangle', 'stealth', 'diamond', 'oval', 'arrow'])) w = NoneSet(values=(['sm', 'med', 'lg'])) len = NoneSet(values=(['sm', 'med', 'lg'])) def __init__(self, type=None, w=None, len=None, ): self.type = type self.w = w self.len = len
class FontReference(Serialisable): idx = NoneSet(values=(['major', 'minor'])) def __init__(self, idx=None, ): self.idx = idx
class PatternFill(Fill): """Area fill patterns for use in styles. Caution: if you do not specify a fill_type, other attributes will have no effect !""" tagname = "patternFill" __fields__ = ('patternType', 'fgColor', 'bgColor') __elements__ = ('fgColor', 'bgColor') patternType = NoneSet(values=fills) fill_type = Alias("patternType") fgColor = ColorDescriptor() start_color = Alias("fgColor") bgColor = ColorDescriptor() end_color = Alias("bgColor") def __init__(self, patternType=None, fgColor=Color(), bgColor=Color(), fill_type=None, start_color=None, end_color=None): if fill_type is not None: patternType = fill_type self.patternType = patternType if start_color is not None: fgColor = start_color self.fgColor = fgColor if end_color is not None: bgColor = end_color self.bgColor = bgColor @classmethod def _from_tree(cls, el): attrib = dict(el.attrib) for child in el: desc = localname(child) attrib[desc] = Color.from_tree(child) return cls(**attrib) def to_tree(self, tagname=None): parent = Element("fill") el = Element(self.tagname) if self.patternType is not None: el.set('patternType', self.patternType) for c in self.__elements__: value = getattr(self, c) if value != Color(): el.append(value.to_tree(c)) parent.append(el) return parent
class SmartTagProperties(Serialisable): tagname = "smartTagPr" embed = Bool(allow_none=True) show = NoneSet(values=(['all', 'noIndicator'])) def __init__(self, embed=None, show=None, ): self.embed = embed self.show = show
class BookView(Serialisable): tagname = "workbookView" visibility = NoneSet(values=(['visible', 'hidden', 'veryHidden'])) minimized = Bool(allow_none=True) showHorizontalScroll = Bool(allow_none=True) showVerticalScroll = Bool(allow_none=True) showSheetTabs = Bool(allow_none=True) xWindow = Integer(allow_none=True) yWindow = Integer(allow_none=True) windowWidth = Integer(allow_none=True) windowHeight = Integer(allow_none=True) tabRatio = Integer(allow_none=True) firstSheet = Integer(allow_none=True) activeTab = Integer(allow_none=True) autoFilterDateGrouping = Bool(allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = () def __init__( self, visibility="visible", minimized=False, showHorizontalScroll=True, showVerticalScroll=True, showSheetTabs=True, xWindow=None, yWindow=None, windowWidth=None, windowHeight=None, tabRatio=600, firstSheet=0, activeTab=0, autoFilterDateGrouping=True, extLst=None, ): self.visibility = visibility self.minimized = minimized self.showHorizontalScroll = showHorizontalScroll self.showVerticalScroll = showVerticalScroll self.showSheetTabs = showSheetTabs self.xWindow = xWindow self.yWindow = yWindow self.windowWidth = windowWidth self.windowHeight = windowHeight self.tabRatio = tabRatio self.firstSheet = firstSheet self.activeTab = activeTab self.autoFilterDateGrouping = autoFilterDateGrouping
class CustomFilter(Serialisable): tagname = "customFilter" operator = NoneSet(values=(['equal', 'lessThan', 'lessThanOrEqual', 'notEqual', 'greaterThanOrEqual', 'greaterThan'])) val = String() def __init__(self, operator=None, val=None, ): self.operator = operator self.val = val
class Selection(Serialisable): pane = NoneSet(values=("bottomRight", "topRight", "bottomLeft", "topLeft")) activeCell = String(allow_none=True) activeCellId = Integer(allow_none=True) sqref = String(allow_none=True) def __init__(self, pane=None, activeCell="A1", activeCellId=None, sqref="A1"): self.pane = pane self.activeCell = activeCell self.activeCellId = activeCellId self.sqref = sqref
class ExternalCell(Serialisable): r = String() t = NoneSet(values=(['b', 'd', 'n', 'e', 's', 'str', 'inlineStr'])) vm = Integer(allow_none=True) v = NestedText(allow_none=True, expected_type=unicode) def __init__(self, r=None, t=None, vm=None, v=None, ): self.r = r self.t = t self.vm = vm self.v = v
class Side(Serialisable): """Border options for use in styles. Caution: if you do not specify a border_style, other attributes will have no effect !""" __fields__ = ('style', 'color') color = ColorDescriptor(allow_none=True) style = NoneSet(values=('dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin')) border_style = Alias('style') def __init__(self, style=None, color=None, border_style=None): if border_style is not None: style = border_style self.style = style self.color = color
class GroupShapeProperties(Serialisable): tagname = "grpSpPr" bwMode = NoneSet(values=(['clr', 'auto', 'gray', 'ltGray', 'invGray', 'grayWhite', 'blackGray', 'blackWhite', 'black', 'white', 'hidden'])) xfrm = Typed(expected_type=GroupTransform2D, allow_none=True) scene3d = Typed(expected_type=Scene3D, allow_none=True) extLst = Typed(expected_type=OfficeArtExtensionList, allow_none=True) def __init__(self, bwMode=None, xfrm=None, scene3d=None, extLst=None, ): self.bwMode = bwMode self.xfrm = xfrm self.scene3d = scene3d self.extLst = extLst
class Path2D(Serialisable): w = Float() h = Float() fill = NoneSet(values=(['norm', 'lighten', 'lightenLess', 'darken', 'darkenLess'])) stroke = Bool(allow_none=True) extrusionOk = Bool(allow_none=True) def __init__(self, w=None, h=None, fill=None, stroke=None, extrusionOk=None, ): self.w = w self.h = h self.fill = fill self.stroke = stroke self.extrusionOk = extrusionOk
class Bevel(Serialisable): tagname = "bevel" w = Integer() h = Integer() prst = NoneSet(values=[ 'relaxedInset', 'circle', 'slope', 'cross', 'angle', 'softRound', 'convex', 'coolSlant', 'divot', 'riblet', 'hardEdge', 'artDeco' ]) def __init__( self, w=None, h=None, prst=None, ): self.w = w self.h = h self.prst = prst
class PivotArea(Serialisable): field = Integer(allow_none=True) type = NoneSet(values=("normal", "data", "all", "origin", "button", "topEnd")) dataOnly = Bool() labelOnly = Bool() grandRow = Bool() grandCol = Bool() cacheIndex = Bool() outline = Bool() offset = String() collapsedLevelsAreSubtotals = Bool() axis = String(allow_none=True) fieldPosition = Integer(allow_none=True) def __init__(self, field=None, type=None, dataOnly=None, labelOnly=None, grandRow=None, grandCol=None, cacheIndex=None, outline=None, offset=None, collapsedLevelsAreSubtotals=None, axis=None, fieldPosition=None): self.field = field self.type = type self.dataOnly = dataOnly self.labelOnly = labelOnly self.grandRow = grandRow self.grandCol = grandCol self.cacheIndex = cacheIndex self.outline = outline self.offset = offset self.collapsedLevelsAreSubtotals = collapsedLevelsAreSubtotals self.axis = axis self.fieldPosition = fieldPosition
class Format(Serialisable): tagname = "format" action = NoneSet(values=(['blank', 'formatting', 'drill', 'formula'])) dxfId = Integer() pivotArea = Typed(expected_type=PivotArea, ) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('pivotArea',) def __init__(self, action=None, dxfId=None, pivotArea=None, extLst=None, ): self.action = action self.dxfId = dxfId self.pivotArea = pivotArea self.extLst = extLst
class Shape3D(Serialisable): namespace = DRAWING_NS z = Typed(expected_type=Coordinate, allow_none=True) extrusionH = Integer(allow_none=True) contourW = Integer(allow_none=True) prstMaterial = NoneSet(values=[ 'legacyMatte', 'legacyPlastic', 'legacyMetal', 'legacyWireframe', 'matte', 'plastic', 'metal', 'warmMatte', 'translucentPowder', 'powder', 'dkEdge', 'softEdge', 'clear', 'flat', 'softmetal' ]) bevelT = Typed(expected_type=Bevel, allow_none=True) bevelB = Typed(expected_type=Bevel, allow_none=True) extrusionClr = Typed(expected_type=Color, allow_none=True) contourClr = Typed(expected_type=Color, allow_none=True) extLst = Typed(expected_type=OfficeArtExtensionList, allow_none=True) def __init__( self, z=None, extrusionH=None, contourW=None, prstMaterial=None, bevelT=None, bevelB=None, extrusionClr=None, contourClr=None, extLst=None, ): self.z = z self.extrusionH = extrusionH self.contourW = contourW self.prstMaterial = prstMaterial self.bevelT = bevelT self.bevelB = bevelB self.extrusionClr = extrusionClr self.contourClr = contourClr self.extLst = extLst