class AxDataSource(Serialisable): tagname = "cat" numRef = Typed(expected_type=NumRef, allow_none=True) numLit = Typed(expected_type=NumData, allow_none=True) strRef = Typed(expected_type=StrRef, allow_none=True) strLit = Typed(expected_type=StrData, allow_none=True) multiLvlStrRef = Typed(expected_type=MultiLevelStrRef, allow_none=True) def __init__( self, numRef=None, numLit=None, strRef=None, strLit=None, multiLvlStrRef=None, ): if not any([numLit, numRef, strRef, strLit, multiLvlStrRef]): raise TypeError("A data source must be provided") self.numRef = numRef self.numLit = numLit self.strRef = strRef self.strLit = strLit self.multiLvlStrRef = multiLvlStrRef
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 BlipFillProperties(Serialisable): tagname = "blipFill" dpi = Integer(allow_none=True) rotWithShape = Bool(allow_none=True) blip = Typed(expected_type=Blip, allow_none=True) srcRect = Typed(expected_type=RelativeRect, allow_none=True) tile = Typed(expected_type=TileInfoProperties, allow_none=True) stretch = Typed(expected_type=StretchInfoProperties, allow_none=True) __elements__ = ("blip", "srcRect", "tile", "stretch") def __init__(self, dpi=None, rotWithShape=None, blip=None, tile=None, stretch=StretchInfoProperties(), srcRect=None, ): self.dpi = dpi self.rotWithShape = rotWithShape self.blip = blip self.tile = tile self.stretch = stretch self.srcRect = srcRect
class CacheSource(Serialisable): tagname = "cacheSource" type = Set(values=(['worksheet', 'external', 'consolidation', 'scenario'])) connectionId = Integer(allow_none=True) # some elements are choice worksheetSource = Typed(expected_type=WorksheetSource, allow_none=True) consolidation = Typed(expected_type=Consolidation, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ( 'worksheetSource', 'consolidation', ) def __init__( self, type=None, connectionId=None, worksheetSource=None, consolidation=None, extLst=None, ): self.type = type self.connectionId = connectionId self.worksheetSource = worksheetSource self.consolidation = consolidation
class Marker(Serialisable): tagname = "marker" symbol = NestedNoneSet(values=([ 'circle', 'dash', 'diamond', 'dot', 'picture', 'plus', 'square', 'star', 'triangle', 'x', 'auto' ]), to_tree=_explicit_none) size = NestedMinMax(min=2, max=72, allow_none=True) spPr = Typed(expected_type=GraphicalProperties, allow_none=True) graphicalProperties = Alias('spPr') extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('symbol', 'size', 'spPr') def __init__( self, symbol=None, size=None, spPr=None, extLst=None, ): self.symbol = symbol self.size = size if spPr is None: spPr = GraphicalProperties() self.spPr = spPr
class PCDSDTCEntries(Serialisable): tagname = "pCDSDTCEntries" count = Integer() # some elements are choice m = Typed(expected_type=Missing, ) n = Typed(expected_type=Number, ) e = Typed(expected_type=Error, ) s = Typed(expected_type=Text) __elements__ = ('m', 'n', 'e', 's') def __init__( self, count=None, m=None, n=None, e=None, s=None, ): self.count = count self.m = m self.n = n self.e = e self.s = s
class GroupLevel(Serialisable): tagname = "groupLevel" uniqueName = String() caption = String() user = Bool() customRollUp = Bool() groups = Typed(expected_type=Groups, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('groups', 'extLst') def __init__( self, uniqueName=None, caption=None, user=None, customRollUp=None, groups=None, extLst=None, ): self.uniqueName = uniqueName self.caption = caption self.user = user self.customRollUp = customRollUp self.groups = groups self.extLst = extLst
class AbsoluteAnchor(_AnchorBase): tagname = "absoluteAnchor" pos = Typed(expected_type=XDRPoint2D) ext = Typed(expected_type=XDRPositiveSize2D) sp = _AnchorBase.sp grpSp = _AnchorBase.grpSp graphicFrame = _AnchorBase.graphicFrame cxnSp = _AnchorBase.cxnSp pic = _AnchorBase.pic contentPart = _AnchorBase.contentPart clientData = _AnchorBase.clientData __elements__ = ('pos', 'ext') + _AnchorBase.__elements__ def __init__(self, pos=None, ext=None, **kw): if pos is None: pos = XDRPoint2D(0, 0) self.pos = pos if ext is None: ext = XDRPositiveSize2D(0, 0) self.ext = ext super(AbsoluteAnchor, self).__init__(**kw)
class OneCellAnchor(_AnchorBase): tagname = "oneCellAnchor" _from = Typed(expected_type=AnchorMarker) ext = Typed(expected_type=XDRPositiveSize2D) sp = _AnchorBase.sp grpSp = _AnchorBase.grpSp graphicFrame = _AnchorBase.graphicFrame cxnSp = _AnchorBase.cxnSp pic = _AnchorBase.pic contentPart = _AnchorBase.contentPart clientData = _AnchorBase.clientData __elements__ = ('_from', 'ext') + _AnchorBase.__elements__ def __init__(self, _from=None, ext=None, **kw): if _from is None: _from = AnchorMarker() self._from = _from if ext is None: ext = XDRPositiveSize2D(0, 0) self.ext = ext super(OneCellAnchor, self).__init__(**kw)
class DisplayUnitsLabelList(Serialisable): tagname = "dispUnits" custUnit = NestedFloat(allow_none=True) builtInUnit = NestedNoneSet(values=([ 'hundreds', 'thousands', 'tenThousands', 'hundredThousands', 'millions', 'tenMillions', 'hundredMillions', 'billions', 'trillions' ])) dispUnitsLbl = Typed(expected_type=DisplayUnitsLabel, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ( 'custUnit', 'builtInUnit', 'dispUnitsLbl', ) def __init__( self, custUnit=None, builtInUnit=None, dispUnitsLbl=None, extLst=None, ): self.custUnit = custUnit self.builtInUnit = builtInUnit self.dispUnitsLbl = dispUnitsLbl
class NumericAxis(_BaseAxis): tagname = "valAx" axId = _BaseAxis.axId scaling = _BaseAxis.scaling delete = _BaseAxis.delete axPos = _BaseAxis.axPos majorGridlines = _BaseAxis.majorGridlines minorGridlines = _BaseAxis.minorGridlines title = _BaseAxis.title numFmt = _BaseAxis.numFmt majorTickMark = _BaseAxis.majorTickMark minorTickMark = _BaseAxis.minorTickMark tickLblPos = _BaseAxis.tickLblPos spPr = _BaseAxis.spPr txPr = _BaseAxis.txPr crossAx = _BaseAxis.crossAx crosses = _BaseAxis.crosses crossesAt = _BaseAxis.crossesAt crossBetween = NestedNoneSet(values=(['between', 'midCat'])) majorUnit = NestedFloat(allow_none=True) minorUnit = NestedFloat(allow_none=True) dispUnits = Typed(expected_type=DisplayUnitsLabelList, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = _BaseAxis.__elements__ + ( 'crossBetween', 'majorUnit', 'minorUnit', 'dispUnits', ) def __init__(self, crossBetween=None, majorUnit=None, minorUnit=None, dispUnits=None, extLst=None, **kw): self.crossBetween = crossBetween self.majorUnit = majorUnit self.minorUnit = minorUnit self.dispUnits = dispUnits kw.setdefault('majorGridlines', ChartLines()) kw.setdefault('axId', 100) kw.setdefault('crossAx', 10) super(NumericAxis, self).__init__(**kw) @classmethod def from_tree(cls, node): """ Special case value axes with no gridlines """ self = super(NumericAxis, cls).from_tree(node) gridlines = node.find("{%s}majorGridlines" % CHART_NS) if gridlines is None: self.majorGridlines = None return self
class DisplayUnitsLabel(Serialisable): tagname = "dispUnitsLbl" layout = Typed(expected_type=Layout, allow_none=True) tx = Typed(expected_type=Text, allow_none=True) text = Alias("tx") spPr = Typed(expected_type=GraphicalProperties, allow_none=True) graphicalProperties = Alias("spPr") txPr = Typed(expected_type=RichText, allow_none=True) textPropertes = Alias("txPr") __elements__ = ('layout', 'tx', 'spPr', 'txPr') def __init__( self, layout=None, tx=None, spPr=None, txPr=None, ): self.layout = layout self.tx = tx self.spPr = spPr self.txPr = txPr
class BarChart(_BarChartBase): tagname = "barChart" barDir = _BarChartBase.barDir grouping = _BarChartBase.grouping varyColors = _BarChartBase.varyColors ser = _BarChartBase.ser dLbls = _BarChartBase.dLbls gapWidth = NestedGapAmount() overlap = NestedOverlap() serLines = Typed(expected_type=ChartLines, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) # chart properties actually used by containing classes x_axis = Typed(expected_type=TextAxis) y_axis = Typed(expected_type=NumericAxis) __elements__ = _BarChartBase.__elements__ + ('gapWidth', 'overlap', 'serLines', 'axId') def __init__(self, gapWidth=150, overlap=None, serLines=None, extLst=None, **kw): self.gapWidth = gapWidth self.overlap = overlap self.serLines = serLines self.x_axis = TextAxis() self.y_axis = NumericAxis() self.legend = Legend() super(BarChart, self).__init__(**kw)
class ExternalLink(Serialisable): tagname = "externalLink" _id = None _path = "/xl/externalLinks/externalLink%s.xml" _rel_type = "externalLink" mime_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml" externalBook = Typed(expected_type=ExternalBook, allow_none=True) file_link = Typed(expected_type=Relationship, allow_none=True) # link to external file __elements__ = ('externalBook', ) def __init__( self, externalBook=None, ddeLink=None, oleLink=None, extLst=None, ): self.externalBook = externalBook # ignore other items for the moment. def to_tree(self): node = super(ExternalLink, self).to_tree() node.set("xmlns", SHEET_MAIN_NS) return node @property def path(self): return self._path % self._id
class Text(Serialisable): """ The value can be either a cell reference or a text element If both are present then the reference will be used. """ tagname = "tx" strRef = Typed(expected_type=StrRef, allow_none=True) rich = Typed(expected_type=RichText, allow_none=True) __elements__ = ("strRef", "rich") def __init__(self, strRef=None, rich=None ): self.strRef = strRef if rich is None: rich = RichText() self.rich = rich def to_tree(self, tagname=None, idx=None, namespace=None): if self.strRef and self.rich: self.rich = None # can only have one return super(Text, self).to_tree(tagname, idx, namespace)
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 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 Title(Serialisable): tagname = "title" tx = Typed(expected_type=Text, allow_none=True) text = Alias('tx') layout = Typed(expected_type=Layout, allow_none=True) overlay = NestedBool(allow_none=True) spPr = Typed(expected_type=GraphicalProperties, allow_none=True) graphicalProperties = Alias('spPr') txPr = Typed(expected_type=RichText, allow_none=True) body = Alias('txPr') extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('tx', 'layout', 'overlay', 'spPr', 'txPr') def __init__(self, tx=None, layout=None, overlay=None, spPr=None, txPr=None, extLst=None, ): if tx is None: tx = Text() self.tx = tx self.layout = layout self.overlay = overlay self.spPr = spPr self.txPr = txPr
class TupleCache(Serialisable): tagname = "tupleCache" entries = Typed(expected_type=PCDSDTCEntries, allow_none=True) sets = Typed(expected_type=OLAPSets, allow_none=True) queryCache = Typed(expected_type=QueryCache, allow_none=True) serverFormats = Typed(expected_type=ServerFormatList, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('entries', 'sets', 'queryCache', 'serverFormats', 'extLst') def __init__( self, entries=None, sets=None, queryCache=None, serverFormats=None, extLst=None, ): self.entries = entries self.sets = sets self.queryCache = queryCache self.serverFormats = serverFormats self.extLst = extLst
class PivotFormat(Serialisable): tagname = "pivotFmt" idx = NestedInteger(nested=True) spPr = Typed(expected_type=GraphicalProperties, allow_none=True) graphicalProperties = Alias("spPr") txPr = Typed(expected_type=RichText, allow_none=True) TextBody = Alias("txPr") marker = Typed(expected_type=Marker, allow_none=True) dLbl = Typed(expected_type=DataLabel, allow_none=True) DataLabel = Alias("dLbl") extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('idx', 'spPr', 'txPr', 'marker', 'dLbl') def __init__( self, idx=0, spPr=None, txPr=None, marker=None, dLbl=None, extLst=None, ): self.idx = idx self.spPr = spPr self.txPr = txPr self.marker = marker self.dLbl = dLbl
class FieldGroup(Serialisable): tagname = "fieldGroup" par = Integer(allow_none=True) base = Integer(allow_none=True) rangePr = Typed(expected_type=RangePr, allow_none=True) discretePr = Typed(expected_type=DiscretePr, allow_none=True) groupItems = Typed(expected_type=GroupItems, allow_none=True) __elements__ = ('rangePr', 'discretePr', 'groupItems') def __init__( self, par=None, base=None, rangePr=None, discretePr=None, groupItems=None, ): self.par = par self.base = base self.rangePr = rangePr self.discretePr = discretePr self.groupItems = groupItems
class _AreaChartBase(ChartBase): grouping = NestedSet(values=(['percentStacked', 'standard', 'stacked'])) varyColors = NestedBool(nested=True, allow_none=True) ser = Sequence(expected_type=Series, allow_none=True) dLbls = Typed(expected_type=DataLabelList, allow_none=True) dataLabels = Alias("dLbls") dropLines = Typed(expected_type=ChartLines, allow_none=True) _series_type = "area" __elements__ = ('grouping', 'varyColors', 'ser', 'dLbls', 'dropLines') def __init__( self, grouping="standard", varyColors=None, ser=(), dLbls=None, dropLines=None, ): self.grouping = grouping self.varyColors = varyColors self.ser = ser self.dLbls = dLbls self.dropLines = dropLines super(_AreaChartBase, self).__init__()
class GraphicFrame(Serialisable): tagname = "graphicFrame" nvGraphicFramePr = Typed(expected_type=NonVisualGraphicFrame) xfrm = Typed(expected_type=XDRTransform2D) graphic = Typed(expected_type=GraphicObject) macro = String(allow_none=True) fPublished = Bool(allow_none=True) __elements__ = ('nvGraphicFramePr', 'xfrm', 'graphic', 'macro', 'fPublished') def __init__(self, nvGraphicFramePr=None, xfrm=None, graphic=None, macro=None, fPublished=None, ): if nvGraphicFramePr is None: nvGraphicFramePr = NonVisualGraphicFrame() self.nvGraphicFramePr = nvGraphicFramePr if xfrm is None: xfrm = XDRTransform2D() self.xfrm = xfrm if graphic is None: graphic = GraphicObject() self.graphic = graphic self.macro = macro self.fPublished = fPublished
class Legend(Serialisable): tagname = "legend" legendPos = NestedSet(values=(['b', 'tr', 'l', 'r', 't'])) position = Alias('legendPos') legendEntry = Sequence(expected_type=LegendEntry) layout = Typed(expected_type=Layout, allow_none=True) overlay = NestedBool(allow_none=True) spPr = Typed(expected_type=GraphicalProperties, allow_none=True) graphicalProperties = Alias('spPr') txPr = Typed(expected_type=RichText, allow_none=True) textProperties = Alias('txPr') extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('legendPos', 'legendEntry', 'layout', 'overlay', 'spPr', 'txPr',) def __init__(self, legendPos="r", legendEntry=(), layout=None, overlay=None, spPr=None, txPr=None, extLst=None, ): self.legendPos = legendPos self.legendEntry = legendEntry self.layout = layout self.overlay = overlay self.spPr = spPr self.txPr = txPr
class NonVisualDrawingProps(Serialisable): tagname = "cNvPr" id = Integer() name = String() descr = String(allow_none=True) hidden = Bool(allow_none=True) title = String(allow_none=True) hlinkClick = Typed(expected_type=Hyperlink, allow_none=True) hlinkHover = Typed(expected_type=Hyperlink, allow_none=True) extLst = Typed(expected_type=OfficeArtExtensionList, allow_none=True) __elements__ = ["hlinkClick", "hlinkHover"] def __init__( self, id=None, name=None, descr=None, hidden=None, title=None, hlinkClick=None, hlinkHover=None, extLst=None, ): self.id = id self.name = name self.descr = descr self.hidden = hidden self.title = title self.hlinkClick = hlinkClick self.hlinkHover = hlinkHover self.extLst = extLst
class Transform2D(Serialisable): tagname = "xfrm" namespace = DRAWING_NS rot = Integer(allow_none=True) flipH = Bool(allow_none=True) flipV = Bool(allow_none=True) off = Typed(expected_type=Point2D, allow_none=True) ext = Typed(expected_type=PositiveSize2D, allow_none=True) chOff = Typed(expected_type=Point2D, allow_none=True) chExt = Typed(expected_type=PositiveSize2D, allow_none=True) __elements__ = ('off', 'ext', 'chOff', 'chExt') def __init__( self, rot=None, flipH=None, flipV=None, off=None, ext=None, chOff=None, chExt=None, ): self.rot = rot self.flipH = flipH self.flipV = flipV self.off = off self.ext = ext self.chOff = chOff self.chExt = chExt
class SolidColorFillProperties(Serialisable): tagname = "solidFill" # uses element group EG_ColorChoice scrgbClr = Typed(expected_type=RGBPercent, allow_none=True) RGBPercent = Alias('scrgbClr') srgbClr = NestedValue(expected_type=unicode, allow_none=True) # needs pattern and can have transform RGB = Alias('srgbClr') hslClr = Typed(expected_type=HSLColor, allow_none=True) sysClr = Typed(expected_type=SystemColor, allow_none=True) schemeClr = Typed(expected_type=SchemeColor, allow_none=True) prstClr = NestedNoneSet(values=PRESET_COLORS) __elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr') def __init__(self, scrgbClr=None, srgbClr=None, hslClr=None, sysClr=None, schemeClr=None, prstClr=None, ): self.scrgbClr = scrgbClr self.srgbClr = srgbClr self.hslClr = hslClr self.sysClr = sysClr self.schemeClr = schemeClr self.prstClr = prstClr
class RichText(Serialisable): """ From the specification: 21.2.2.216 This element specifies text formatting. The lstStyle element is not supported. """ tagname = "rich" bodyPr = Typed(expected_type=RichTextProperties) properties = Alias("bodyPr") lstStyle = Typed(expected_type=ListStyle, allow_none=True) p = Sequence(expected_type=Paragraph) paragraphs = Alias('p') __elements__ = ("bodyPr", "lstStyle", "p") def __init__(self, bodyPr=None, lstStyle=None, p=None, ): if bodyPr is None: bodyPr = RichTextProperties() self.bodyPr = bodyPr self.lstStyle = lstStyle if p is None: p = [Paragraph()] self.p = p
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 DataTable(Serialisable): tagname = "dTable" showHorzBorder = NestedBool(allow_none=True) showVertBorder = NestedBool(allow_none=True) showOutline = NestedBool(allow_none=True) showKeys = NestedBool(allow_none=True) spPr = Typed(expected_type=GraphicalProperties, allow_none=True) graphicalProperties = Alias('spPr') txPr = Typed(expected_type=RichText, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('showHorzBorder', 'showVertBorder', 'showOutline', 'showKeys', 'spPr', 'txPr') def __init__( self, showHorzBorder=None, showVertBorder=None, showOutline=None, showKeys=None, spPr=None, txPr=None, extLst=None, ): self.showHorzBorder = showHorzBorder self.showVertBorder = showVertBorder self.showOutline = showOutline self.showKeys = showKeys self.spPr = spPr self.txPr = txPr