class Shape(Serialisable): macro = String(allow_none=True) textlink = String(allow_none=True) fPublished = Bool(allow_none=True) fLocksText = Bool(allow_none=True) nvSpPr = Typed(expected_type=ShapeMeta, allow_none=True) meta = Alias("nvSpPr") spPr = Typed(expected_type=GraphicalProperties) graphicalProperties = Alias("spPr") style = Typed(expected_type=ShapeStyle, allow_none=True) txBody = Typed(expected_type=RichText, allow_none=True) def __init__(self, macro=None, textlink=None, fPublished=None, fLocksText=None, nvSpPr=None, spPr=None, style=None, txBody=None, ): self.macro = macro self.textlink = textlink self.fPublished = fPublished self.fLocksText = fLocksText self.nvSpPr = nvSpPr self.spPr = spPr self.style = style self.txBody = txBody
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 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 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 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=ServerFormats, 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 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 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 PictureFrame(Serialisable): tagname = "pic" macro = String(allow_none=True) fPublished = Bool(allow_none=True) nvPicPr = Typed(expected_type=PictureNonVisual, ) blipFill = Typed(expected_type=BlipFillProperties, ) spPr = Typed(expected_type=GraphicalProperties, ) graphicalProperties = Alias('spPr') style = Typed(expected_type=ShapeStyle, allow_none=True) __elements__ = ("nvPicPr", "blipFill", "spPr", "style") def __init__( self, macro=None, fPublished=None, nvPicPr=None, blipFill=None, spPr=None, style=None, ): self.macro = macro self.fPublished = fPublished if nvPicPr is None: nvPicPr = PictureNonVisual() self.nvPicPr = nvPicPr if blipFill is None: blipFill = BlipFillProperties() self.blipFill = blipFill if spPr is None: spPr = GraphicalProperties() self.spPr = spPr self.style = style
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 CustomChartsheetView(Serialisable): tagname = "customSheetView" guid = Guid() scale = Integer() state = Set(values=(['visible', 'hidden', 'veryHidden'])) zoomToFit = Bool(allow_none=True) pageMargins = Typed(expected_type=PageMargins, allow_none=True) pageSetup = Typed(expected_type=PrintPageSetup, allow_none=True) headerFooter = Typed(expected_type=HeaderFooter, allow_none=True) __elements__ = ('pageMargins', 'pageSetup', 'headerFooter') def __init__( self, guid=None, scale=None, state='visible', zoomToFit=None, pageMargins=None, pageSetup=None, headerFooter=None, ): self.guid = guid self.scale = scale self.state = state self.zoomToFit = zoomToFit self.pageMargins = pageMargins self.pageSetup = pageSetup self.headerFooter = headerFooter
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 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 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 RadarChart(ChartBase): tagname = "radarChart" radarStyle = NestedSet(values=(['standard', 'marker', 'filled'])) type = Alias("radarStyle") 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") extLst = Typed(expected_type=ExtensionList, allow_none=True) _series_type = "radar" x_axis = Typed(expected_type=TextAxis) y_axis = Typed(expected_type=NumericAxis) __elements__ = ('radarStyle', 'varyColors', 'ser', 'dLbls', 'axId') def __init__(self, radarStyle="standard", varyColors=None, ser=(), dLbls=None, extLst=None, **kw): self.radarStyle = radarStyle self.varyColors = varyColors self.ser = ser self.dLbls = dLbls self.x_axis = TextAxis() self.y_axis = NumericAxis() super(RadarChart, self).__init__(**kw)
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 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 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 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 Paragraph(Serialisable): tagname = "p" namespace = DRAWING_NS # uses element group EG_TextRun pPr = Typed(expected_type=ParagraphProperties, allow_none=True) properties = Alias("pPr") endParaRPr = Typed(expected_type=CharacterProperties, allow_none=True) r = Sequence(expected_type=RegularTextRun) text = Alias('r') br = Typed(expected_type=LineBreak, allow_none=True) fld = Typed(expected_type=TextField, allow_none=True) __elements__ = ('pPr', 'r', 'br', 'fld', 'endParaRPr') def __init__( self, pPr=None, endParaRPr=None, r=None, br=None, fld=None, ): self.pPr = pPr self.endParaRPr = endParaRPr if r is None: r = [RegularTextRun()] self.r = r self.br = br self.fld = fld
class ExternalLink(Serialisable): tagname = "externalLink" _id = None _path = "/xl/externalLinks/externalLink{0}.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.format(self._id)
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
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 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 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 _3DBase(Serialisable): """ Base class for 3D charts """ view3D = Typed(expected_type=View3D, allow_none=True) floor = Typed(expected_type=Surface, allow_none=True) sideWall = Typed(expected_type=Surface, allow_none=True) backWall = Typed(expected_type=Surface, allow_none=True) def __init__(self, view3D=None, floor=None, sideWall=None, backWall=None ): if view3D is None: view3D = View3D() self.view3D = view3D if floor is None: floor = Surface() self.floor = floor if sideWall is None: sideWall = Surface() self.sideWall = sideWall if backWall is None: backWall = Surface() self.backWall = backWall
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 _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 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)