Esempio n. 1
0
class Properties(Serialisable):

    locked = Bool(allow_none=True)
    defaultSize = Bool(allow_none=True)
    _print = Bool(allow_none=True)
    disabled = Bool(allow_none=True)
    uiObject = Bool(allow_none=True)
    autoFill = Bool(allow_none=True)
    autoLine = Bool(allow_none=True)
    altText = String(allow_none=True)
    textHAlign = Set(
        values=(['left', 'center', 'right', 'justify', 'distributed']))
    textVAlign = Set(
        values=(['top', 'center', 'bottom', 'justify', 'distributed']))
    lockText = Bool(allow_none=True)
    justLastX = Bool(allow_none=True)
    autoScale = Bool(allow_none=True)
    rowHidden = Bool(allow_none=True)
    colHidden = Bool(allow_none=True)
    anchor = Typed(expected_type=ObjectAnchor, )

    __elements__ = ('anchor', )

    def __init__(
        self,
        locked=None,
        defaultSize=None,
        _print=None,
        disabled=None,
        uiObject=None,
        autoFill=None,
        autoLine=None,
        altText=None,
        textHAlign=None,
        textVAlign=None,
        lockText=None,
        justLastX=None,
        autoScale=None,
        rowHidden=None,
        colHidden=None,
        anchor=None,
    ):
        self.locked = locked
        self.defaultSize = defaultSize
        self._print = _print
        self.disabled = disabled
        self.uiObject = uiObject
        self.autoFill = autoFill
        self.autoLine = autoLine
        self.altText = altText
        self.textHAlign = textHAlign
        self.textVAlign = textVAlign
        self.lockText = lockText
        self.justLastX = justLastX
        self.autoScale = autoScale
        self.rowHidden = rowHidden
        self.colHidden = colHidden
        self.anchor = anchor
Esempio n. 2
0
class AutonumberBullet(Serialisable):

    type = Set(values=([
        'alphaLcParenBoth', 'alphaUcParenBoth', 'alphaLcParenR',
        'alphaUcParenR', 'alphaLcPeriod', 'alphaUcPeriod', 'arabicParenBoth',
        'arabicParenR', 'arabicPeriod', 'arabicPlain', 'romanLcParenBoth',
        'romanUcParenBoth', 'romanLcParenR', 'romanUcParenR', 'romanLcPeriod',
        'romanUcPeriod', 'circleNumDbPlain', 'circleNumWdBlackPlain',
        'circleNumWdWhitePlain', 'arabicDbPeriod', 'arabicDbPlain',
        'ea1ChsPeriod', 'ea1ChsPlain', 'ea1ChtPeriod', 'ea1ChtPlain',
        'ea1JpnChsDbPeriod', 'ea1JpnKorPlain', 'ea1JpnKorPeriod',
        'arabic1Minus', 'arabic2Minus', 'hebrew2Minus', 'thaiAlphaPeriod',
        'thaiAlphaParenR', 'thaiAlphaParenBoth', 'thaiNumPeriod',
        'thaiNumParenR', 'thaiNumParenBoth', 'hindiAlphaPeriod',
        'hindiNumPeriod', 'hindiNumParenR', 'hindiAlpha1Period'
    ]))
    startAt = Integer()

    def __init__(
        self,
        type=None,
        startAt=None,
    ):
        self.type = type
        self.startAt = startAt
Esempio n. 3
0
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
Esempio n. 4
0
class DynamicFilter(Serialisable):

    tagname = "dynamicFilter"

    type = Set(values=([
        'null', 'aboveAverage', 'belowAverage', 'tomorrow', 'today',
        'yesterday', 'nextWeek', 'thisWeek', 'lastWeek', 'nextMonth',
        'thisMonth', 'lastMonth', 'nextQuarter', 'thisQuarter', 'lastQuarter',
        'nextYear', 'thisYear', 'lastYear', 'yearToDate', 'Q1', 'Q2', 'Q3',
        'Q4', 'M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'M8', 'M9', 'M10',
        'M11', 'M12'
    ]))
    val = Float(allow_none=True)
    valIso = DateTime(allow_none=True)
    maxVal = Float(allow_none=True)
    maxValIso = DateTime(allow_none=True)

    def __init__(
        self,
        type=None,
        val=None,
        valIso=None,
        maxVal=None,
        maxValIso=None,
    ):
        self.type = type
        self.val = val
        self.valIso = valIso
        self.maxVal = maxVal
        self.maxValIso = maxValIso
Esempio n. 5
0
class RowColItem(Serialisable):

    tagname = "i"

    t = Set(values=([
        'data', 'default', 'sum', 'countA', 'avg', 'max', 'min', 'product',
        'count', 'stdDev', 'stdDevP', 'var', 'varP', 'grand', 'blank'
    ]))
    r = Integer()
    i = Integer()
    x = NestedInteger(allow_none=True, attribute="v")

    __elements__ = ('x', )

    def __init__(
        self,
        t="data",
        r=0,
        i=0,
        x=None,
    ):
        self.t = t
        self.r = r
        self.i = i
        self.x = x
Esempio n. 6
0
class DateGroupItem(Serialisable):

    tagname = "dateGroupItem"

    year = Integer()
    month = MinMax(min=1, max=12, allow_none=True)
    day = MinMax(min=1, max=31, allow_none=True)
    hour = MinMax(min=0, max=23, allow_none=True)
    minute = MinMax(min=0, max=59, allow_none=True)
    second = Integer(min=0, max=59, allow_none=True)
    dateTimeGrouping = Set(
        values=(['year', 'month', 'day', 'hour', 'minute', 'second']))

    def __init__(
        self,
        year=None,
        month=None,
        day=None,
        hour=None,
        minute=None,
        second=None,
        dateTimeGrouping=None,
    ):
        self.year = year
        self.month = month
        self.day = day
        self.hour = hour
        self.minute = minute
        self.second = second
        self.dateTimeGrouping = dateTimeGrouping
Esempio n. 7
0
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
Esempio n. 8
0
class WebPublishItem(Serialisable):
    tagname = "webPublishItem"

    id = Integer()
    divId = String()
    sourceType = Set(values=([
        'sheet', 'printArea', 'autoFilter', 'range', 'chart', 'pivotTable',
        'query', 'label'
    ]))
    sourceRef = String()
    sourceObject = String(allow_none=True)
    destinationFile = String()
    title = String(allow_none=True)
    autoRepublish = Bool(allow_none=True)

    def __init__(
        self,
        id=None,
        divId=None,
        sourceType=None,
        sourceRef=None,
        sourceObject=None,
        destinationFile=None,
        title=None,
        autoRepublish=None,
    ):
        self.id = id
        self.divId = divId
        self.sourceType = sourceType
        self.sourceRef = sourceRef
        self.sourceObject = sourceObject
        self.destinationFile = destinationFile
        self.title = title
        self.autoRepublish = autoRepublish
Esempio n. 9
0
class PresetShadowEffect(ColorChoice):

    prst = Set(values=([
        'shdw1', 'shdw2', 'shdw3', 'shdw4', 'shdw5', 'shdw6', 'shdw7', 'shdw8',
        'shdw9', 'shdw10', 'shdw11', 'shdw12', 'shdw13', 'shdw14', 'shdw15',
        'shdw16', 'shdw17', 'shdw18', 'shdw19', 'shdw20'
    ]))
    dist = Float()
    dir = Integer()
    # uses element group EG_ColorChoice
    scrgbClr = ColorChoice.scrgbClr
    srgbClr = ColorChoice.srgbClr
    hslClr = ColorChoice.hslClr
    sysClr = ColorChoice.sysClr
    schemeClr = ColorChoice.schemeClr
    prstClr = ColorChoice.prstClr

    __elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr',
                    'prstClr')

    def __init__(self, prst=None, dist=None, dir=None, **kw):
        self.prst = prst
        self.dist = dist
        self.dir = dir
        super(PresetShadowEffect, self).__init__(**kw)
Esempio n. 10
0
class RangePr(Serialisable):

    tagname = "rangePr"

    autoStart = Bool(allow_none=True)
    autoEnd = Bool(allow_none=True)
    groupBy = Set(values=([
        'range', 'seconds', 'minutes', 'hours', 'days', 'months', 'quarters',
        'years'
    ]))
    startNum = Float(allow_none=True)
    endNum = Float(allow_none=True)
    startDate = DateTime(allow_none=True)
    endDate = DateTime(allow_none=True)
    groupInterval = Float(allow_none=True)

    def __init__(
        self,
        autoStart=True,
        autoEnd=True,
        groupBy=range,
        startNum=None,
        endNum=None,
        startDate=None,
        endDate=None,
        groupInterval=1,
    ):
        self.autoStart = autoStart
        self.autoEnd = autoEnd
        self.groupBy = groupBy
        self.startNum = startNum
        self.endNum = endNum
        self.startDate = startDate
        self.endDate = endDate
        self.groupInterval = groupInterval
Esempio n. 11
0
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
Esempio n. 12
0
class FillOverlayEffect(Serialisable):

    blend = Set(values=(['over', 'mult', 'screen', 'darken', 'lighten']))

    def __init__(
        self,
        blend=None,
    ):
        self.blend = blend
Esempio n. 13
0
class Pane(Serialisable):
    xSplit = Float(allow_none=True)
    ySplit = Float(allow_none=True)
    topLeftCell = String(allow_none=True)
    activePane = Set(values=("bottomRight", "topRight", "bottomLeft",
                             "topLeft"))
    state = Set(values=("split", "frozen", "frozenSplit"))

    def __init__(self,
                 xSplit=None,
                 ySplit=None,
                 topLeftCell=None,
                 activePane="topLeft",
                 state="split"):
        self.xSplit = xSplit
        self.ySplit = ySplit
        self.topLeftCell = topLeftCell
        self.activePane = activePane
        self.state = state
Esempio n. 14
0
class GradientFill(Fill):
    """Fill areas with gradient

    Two types of gradient fill are supported:

        - A type='linear' gradient interpolates colours between
          a set of specified Stops, across the length of an area.
          The gradient is left-to-right by default, but this
          orientation can be modified with the degree
          attribute.  A list of Colors can be provided instead
          and they will be positioned with equal distance between them.

        - A type='path' gradient applies a linear gradient from each
          edge of the area. Attributes top, right, bottom, left specify
          the extent of fill from the respective borders. Thus top="0.2"
          will fill the top 20% of the cell.

    """

    tagname = "gradientFill"

    type = Set(values=('linear', 'path'))
    fill_type = Alias("type")
    degree = Float()
    left = Float()
    right = Float()
    top = Float()
    bottom = Float()
    stop = StopList()


    def __init__(self, type="linear", degree=0, left=0, right=0, top=0,
                 bottom=0, stop=()):
        self.degree = degree
        self.left = left
        self.right = right
        self.top = top
        self.bottom = bottom
        self.stop = stop
        self.type = type


    def __iter__(self):
        for attr in self.__attrs__:
            value = getattr(self, attr)
            if value:
                yield attr, safe_string(value)


    def to_tree(self, tagname=None, namespace=None, idx=None):
        parent = Element("fill")
        el = super(GradientFill, self).to_tree()
        parent.append(el)
        return parent
Esempio n. 15
0
class EffectContainer(Serialisable):

    type = Set(values=(['sib', 'tree']))
    name = String(allow_none=True)

    def __init__(
        self,
        type=None,
        name=None,
    ):
        self.type = type
        self.name = name
Esempio n. 16
0
class TabStop(Serialisable):

    pos = Typed(expected_type=Coordinate, allow_none=True)
    algn = Typed(expected_type=Set(values=(['l', 'ctr', 'r', 'dec'])))

    def __init__(
        self,
        pos=None,
        algn=None,
    ):
        self.pos = pos
        self.algn = algn
Esempio n. 17
0
class DataField(Serialisable):

    tagname = "dataField"

    name = String(allow_none=True)
    fld = Integer()
    subtotal = Set(values=([
        'average', 'count', 'countNums', 'max', 'min', 'product', 'stdDev',
        'stdDevp', 'sum', 'var', 'varp'
    ]))
    showDataAs = Set(values=([
        'normal', 'difference', 'percent', 'percentDiff', 'runTotal',
        'percentOfRow', 'percentOfCol', 'percentOfTotal', 'index'
    ]))
    baseField = Integer()
    baseItem = Integer()
    numFmtId = Integer(allow_none=True)
    extLst = Typed(expected_type=ExtensionList, allow_none=True)

    __elements__ = ()

    def __init__(
        self,
        name=None,
        fld=None,
        subtotal="sum",
        showDataAs="normal",
        baseField=-1,
        baseItem=1048832,
        numFmtId=None,
        extLst=None,
    ):
        self.name = name
        self.fld = fld
        self.subtotal = subtotal
        self.showDataAs = showDataAs
        self.baseField = baseField
        self.baseItem = baseItem
        self.numFmtId = numFmtId
        self.extLst = extLst
Esempio n. 18
0
class LightRig(Serialisable):

    tagname = "lightRig"

    rig = Set(values=[
        'legacyFlat1', 'legacyFlat2', 'legacyFlat3', 'legacyFlat4',
        'legacyNormal1', 'legacyNormal2', 'legacyNormal3', 'legacyNormal4',
        'legacyHarsh1', 'legacyHarsh2', 'legacyHarsh3', 'legacyHarsh4',
        'threePt', 'balanced', 'soft', 'harsh', 'flood', 'contrasting',
        'morning', 'sunrise', 'sunset', 'chilly', 'freezing', 'flat', 'twoPt',
        'glow', 'brightRoom'
    ])
    dir = Set(values=(['tl', 't', 'tr', 'l', 'r', 'bl', 'b', 'br']))
    rot = Typed(expected_type=SphereCoords, allow_none=True)

    def __init__(
        self,
        rig=None,
        dir=None,
        rot=None,
    ):
        self.rig = rig
        self.dir = dir
        self.rot = rot
Esempio n. 19
0
class ReflectionEffect(Serialisable):

    blurRad = Float()
    stA = Integer()
    stPos = Integer()
    endA = Integer()
    endPos = Integer()
    dist = Float()
    dir = Integer()
    fadeDir = Integer()
    sx = Integer()
    sy = Integer()
    kx = Integer()
    ky = Integer()
    algn = Set(values=(['tl', 't', 'tr', 'l', 'ctr', 'r', 'bl', 'b', 'br']))
    rotWithShape = Bool(allow_none=True)

    def __init__(
        self,
        blurRad=None,
        stA=None,
        stPos=None,
        endA=None,
        endPos=None,
        dist=None,
        dir=None,
        fadeDir=None,
        sx=None,
        sy=None,
        kx=None,
        ky=None,
        algn=None,
        rotWithShape=None,
    ):
        self.blurRad = blurRad
        self.stA = stA
        self.stPos = stPos
        self.endA = endA
        self.endPos = endPos
        self.dist = dist
        self.dir = dir
        self.fadeDir = fadeDir
        self.sx = sx
        self.sy = sy
        self.kx = kx
        self.ky = ky
        self.algn = algn
        self.rotWithShape = rotWithShape
Esempio n. 20
0
class Camera(Serialisable):

    tagname = "camera"

    prst = Set(values=[
        'legacyObliqueTopLeft', 'legacyObliqueTop', 'legacyObliqueTopRight',
        'legacyObliqueLeft', 'legacyObliqueFront', 'legacyObliqueRight',
        'legacyObliqueBottomLeft', 'legacyObliqueBottom',
        'legacyObliqueBottomRight', 'legacyPerspectiveTopLeft',
        'legacyPerspectiveTop', 'legacyPerspectiveTopRight',
        'legacyPerspectiveLeft', 'legacyPerspectiveFront',
        'legacyPerspectiveRight', 'legacyPerspectiveBottomLeft',
        'legacyPerspectiveBottom', 'legacyPerspectiveBottomRight',
        'orthographicFront', 'isometricTopUp', 'isometricTopDown',
        'isometricBottomUp', 'isometricBottomDown', 'isometricLeftUp',
        'isometricLeftDown', 'isometricRightUp', 'isometricRightDown',
        'isometricOffAxis1Left', 'isometricOffAxis1Right',
        'isometricOffAxis1Top', 'isometricOffAxis2Left',
        'isometricOffAxis2Right', 'isometricOffAxis2Top',
        'isometricOffAxis3Left', 'isometricOffAxis3Right',
        'isometricOffAxis3Bottom', 'isometricOffAxis4Left',
        'isometricOffAxis4Right', 'isometricOffAxis4Bottom', 'obliqueTopLeft',
        'obliqueTop', 'obliqueTopRight', 'obliqueLeft', 'obliqueRight',
        'obliqueBottomLeft', 'obliqueBottom', 'obliqueBottomRight',
        'perspectiveFront', 'perspectiveLeft', 'perspectiveRight',
        'perspectiveAbove', 'perspectiveBelow', 'perspectiveAboveLeftFacing',
        'perspectiveAboveRightFacing', 'perspectiveContrastingLeftFacing',
        'perspectiveContrastingRightFacing', 'perspectiveHeroicLeftFacing',
        'perspectiveHeroicRightFacing', 'perspectiveHeroicExtremeLeftFacing',
        'perspectiveHeroicExtremeRightFacing', 'perspectiveRelaxed',
        'perspectiveRelaxedModerately'
    ])
    fov = Integer(allow_none=True)
    zoom = Typed(expected_type=Percentage, allow_none=True)
    rot = Typed(expected_type=SphereCoords, allow_none=True)

    def __init__(
        self,
        prst=None,
        fov=None,
        zoom=None,
        rot=None,
    ):
        self.prst = prst
        self.fov = fov
        self.zoom = zoom
        self.rot = rot
Esempio n. 21
0
class OuterShadow(ColorChoice):

    tagname = "outerShdw"

    blurRad = Float(allow_none=True)
    dist = Float(allow_none=True)
    dir = Integer(allow_none=True)
    sx = Integer(allow_none=True)
    sy = Integer(allow_none=True)
    kx = Integer(allow_none=True)
    ky = Integer(allow_none=True)
    algn = Set(values=['tl', 't', 'tr', 'l', 'ctr', 'r', 'bl', 'b', 'br'])
    rotWithShape = Bool(allow_none=True)
    # uses element group EG_ColorChoice
    scrgbClr = ColorChoice.scrgbClr
    srgbClr = ColorChoice.srgbClr
    hslClr = ColorChoice.hslClr
    sysClr = ColorChoice.sysClr
    schemeClr = ColorChoice.schemeClr
    prstClr = ColorChoice.prstClr

    __elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr',
                    'prstClr')

    def __init__(self,
                 blurRad=None,
                 dist=None,
                 dir=None,
                 sx=None,
                 sy=None,
                 kx=None,
                 ky=None,
                 algn=None,
                 rotWithShape=None,
                 **kw):
        self.blurRad = blurRad
        self.dist = dist
        self.dir = dir
        self.sx = sx
        self.sy = sy
        self.kx = kx
        self.ky = ky
        self.algn = algn
        self.rotWithShape = rotWithShape
        super(OuterShadow, self).__init__(**kw)
Esempio n. 22
0
class FieldItem(Serialisable):

    tagname = "item"

    n = String(allow_none=True)
    t = Set(values=([
        'data', 'default', 'sum', 'countA', 'avg', 'max', 'min', 'product',
        'count', 'stdDev', 'stdDevP', 'var', 'varP', 'grand', 'blank'
    ]))
    h = Bool(allow_none=True)
    s = Bool(allow_none=True)
    sd = Bool(allow_none=True)
    f = Bool(allow_none=True)
    m = Bool(allow_none=True)
    c = Bool(allow_none=True)
    x = Integer(allow_none=True)
    d = Bool(allow_none=True)
    e = Bool(allow_none=True)

    def __init__(
        self,
        n=None,
        t="data",
        h=None,
        s=None,
        sd=True,
        f=None,
        m=None,
        c=None,
        x=None,
        d=None,
        e=None,
    ):
        self.n = n
        self.t = t
        self.h = h
        self.s = s
        self.sd = sd
        self.f = f
        self.m = m
        self.c = c
        self.x = x
        self.d = d
        self.e = e
Esempio n. 23
0
class IconFilter(Serialisable):

    tagname = "iconFilter"

    iconSet = Set(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,
        iconSet=None,
        iconId=None,
    ):
        self.iconSet = iconSet
        self.iconId = iconId
Esempio n. 24
0
class PresetTextShape(Serialisable):

    prst = Typed(expected_type=Set(values=([
        'textNoShape', 'textPlain', 'textStop', 'textTriangle',
        'textTriangleInverted', 'textChevron', 'textChevronInverted',
        'textRingInside', 'textRingOutside', 'textArchUp', 'textArchDown',
        'textCircle', 'textButton', 'textArchUpPour', 'textArchDownPour',
        'textCirclePour', 'textButtonPour', 'textCurveUp', 'textCurveDown',
        'textCanUp', 'textCanDown', 'textWave1', 'textWave2',
        'textDoubleWave1', 'textWave4', 'textInflate', 'textDeflate',
        'textInflateBottom', 'textDeflateBottom', 'textInflateTop',
        'textDeflateTop', 'textDeflateInflate', 'textDeflateInflateDeflate',
        'textFadeRight', 'textFadeLeft', 'textFadeUp', 'textFadeDown',
        'textSlantUp', 'textSlantDown', 'textCascadeUp', 'textCascadeDown'
    ])))
    avLst = Typed(expected_type=GeomGuideList, allow_none=True)

    def __init__(
        self,
        prst=None,
        avLst=None,
    ):
        self.prst = prst
        self.avLst = avLst
Esempio n. 25
0
class Chartsheet(_WorkbookChild, Serialisable):

    tagname = "chartsheet"
    _default_title = "Chart"
    _rel_type = "chartsheet"
    _path = "/xl/chartsheets/sheet{0}.xml"
    mime_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml"

    sheetPr = Typed(expected_type=ChartsheetProperties, allow_none=True)
    sheetViews = Typed(expected_type=ChartsheetViewList)
    sheetProtection = Typed(expected_type=ChartsheetProtection, allow_none=True)
    customSheetViews = Typed(expected_type=CustomChartsheetViews, allow_none=True)
    pageMargins = Typed(expected_type=PageMargins, allow_none=True)
    pageSetup = Typed(expected_type=PrintPageSetup, allow_none=True)
    drawing = Typed(expected_type=Drawing, allow_none=True)
    drawingHF = Typed(expected_type=DrawingHF, allow_none=True)
    picture = Typed(expected_type=SheetBackgroundPicture, allow_none=True)
    webPublishItems = Typed(expected_type=WebPublishItems, allow_none=True)
    extLst = Typed(expected_type=ExtensionList, allow_none=True)
    sheet_state = Set(values=('visible', 'hidden', 'veryHidden'))
    headerFooter = Typed(expected_type=HeaderFooter)
    HeaderFooter = Alias('headerFooter')

    __elements__ = (
        'sheetPr', 'sheetViews', 'sheetProtection', 'customSheetViews',
        'pageMargins', 'pageSetup', 'headerFooter', 'drawing', 'drawingHF',
        'picture', 'webPublishItems')

    __attrs__ = ()

    def __init__(self,
                 sheetPr=None,
                 sheetViews=None,
                 sheetProtection=None,
                 customSheetViews=None,
                 pageMargins=None,
                 pageSetup=None,
                 headerFooter=None,
                 drawing=None,
                 drawingHF=None,
                 picture=None,
                 webPublishItems=None,
                 extLst=None,
                 parent=None,
                 title="",
                 sheet_state='visible',
                 ):
        super(Chartsheet, self).__init__(parent, title)
        self._charts = []
        self.sheetPr = sheetPr
        if sheetViews is None:
            sheetViews = ChartsheetViewList()
        self.sheetViews = sheetViews
        self.sheetProtection = sheetProtection
        self.customSheetViews = customSheetViews
        self.pageMargins = pageMargins
        self.pageSetup = pageSetup
        if headerFooter is not None:
            self.headerFooter = headerFooter
        self.drawing = Drawing("rId1")
        self.drawingHF = drawingHF
        self.picture = picture
        self.webPublishItems = webPublishItems
        self.sheet_state = sheet_state


    def add_chart(self, chart):
        chart.anchor = AbsoluteAnchor()
        self._charts.append(chart)


    def to_tree(self):
        self._drawing = SpreadsheetDrawing()
        self._drawing.charts = self._charts
        tree = super(Chartsheet, self).to_tree()
        if not self.headerFooter:
            el = tree.find('headerFooter')
            tree.remove(el)
        tree.set("xmlns", SHEET_MAIN_NS)
        return tree
Esempio n. 26
0
class ChartBase(Serialisable):
    """
    Base class for all charts
    """

    legend = Typed(expected_type=Legend, allow_none=True)
    layout = Typed(expected_type=Layout, allow_none=True)
    roundedCorners = Bool(allow_none=True)
    axId = ValueSequence(expected_type=int)
    visible_cells_only = Bool()
    display_blanks = Set(values=['span', 'gap', 'zero'])

    _series_type = ""
    ser = ()
    series = Alias('ser')
    title = TitleDescriptor()
    anchor = "E15"  # default anchor position
    width = 15  # in cm, approx 5 rows
    height = 7.5  # in cm, approx 14 rows
    _id = 1
    _path = "/xl/charts/chart{0}.xml"
    style = MinMax(allow_none=True, min=1, max=48)
    mime_type = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml"
    graphical_properties = Typed(expected_type=GraphicalProperties,
                                 allow_none=True)

    __elements__ = ()

    def __init__(self, axId=(), **kw):
        self._charts = [self]
        self.title = None
        self.layout = None
        self.roundedCorners = None
        self.legend = Legend()
        self.graphical_properties = None
        self.style = None
        self.plot_area = PlotArea()
        self.axId = axId
        self.display_blanks = 'gap'

    def __hash__(self):
        """
        Just need to check for identity
        """
        return id(self)

    def __iadd__(self, other):
        """
        Combine the chart with another one
        """
        if not isinstance(other, ChartBase):
            raise TypeError("Only other charts can be added")
        self._charts.append(other)
        return self

    def to_tree(self, namespace=None, tagname=None, idx=None):
        self.axId = [id for id in self._axes]
        if self.ser is not None:
            for s in self.ser:
                s.__elements__ = attribute_mapping[self._series_type]
        return super(ChartBase, self).to_tree(tagname, idx)

    def _write(self):
        from .chartspace import ChartSpace, ChartContainer
        self.plot_area.layout = self.layout

        idx_base = 0
        for chart in self._charts:
            if chart not in self.plot_area._charts:
                chart.idx_base = idx_base
                idx_base += len(chart.series)
        self.plot_area._charts = self._charts

        container = ChartContainer(plotArea=self.plot_area,
                                   legend=self.legend,
                                   title=self.title)
        if isinstance(chart, _3DBase):
            container.view3D = chart.view3D
            container.floor = chart.floor
            container.sideWall = chart.sideWall
            container.backWall = chart.backWall
        container.plotVisOnly = self.visible_cells_only
        container.dispBlanksAs = self.display_blanks
        cs = ChartSpace(chart=container)
        cs.style = self.style
        cs.roundedCorners = self.roundedCorners
        return cs.to_tree()

    @property
    def _axes(self):
        x = getattr(self, "x_axis", None)
        y = getattr(self, "y_axis", None)
        z = getattr(self, "z_axis", None)
        return OrderedDict([(axis.axId, axis) for axis in (x, y, z) if axis])

    def set_categories(self, labels):
        """
        Set the categories / x-axis values
        """
        if not isinstance(labels, Reference):
            labels = Reference(range_string=labels)
        for s in self.ser:
            s.cat = AxDataSource(numRef=NumRef(f=labels))

    def add_data(self, data, from_rows=False, titles_from_data=False):
        """
        Add a range of data in a single pass.
        The default is to treat each column as a data series.
        """
        if not isinstance(data, Reference):
            data = Reference(range_string=data)

        if from_rows:
            values = data.rows

        else:
            values = data.cols

        for v in values:
            range_string = u"{0}!{1}:{2}".format(data.sheetname, v[0], v[-1])
            series = SeriesFactory(range_string,
                                   title_from_data=titles_from_data)
            self.ser.append(series)

    def append(self, value):
        """Append a data series to the chart"""
        l = self.series[:]
        l.append(value)
        self.series = l

    @property
    def path(self):
        return self._path.format(self._id)
Esempio n. 27
0
class SystemColor(Serialisable):

    tagname = "sysClr"
    namespace = DRAWING_NS

    # color transform options
    tint = NestedInteger(allow_none=True)
    shade = NestedInteger(allow_none=True)
    comp = Typed(expected_type=Transform, allow_none=True)
    inv = Typed(expected_type=Transform, allow_none=True)
    gray = Typed(expected_type=Transform, allow_none=True)
    alpha = NestedInteger(allow_none=True)
    alphaOff = NestedInteger(allow_none=True)
    alphaMod = NestedInteger(allow_none=True)
    hue = NestedInteger(allow_none=True)
    hueOff = NestedInteger(allow_none=True)
    hueMod = NestedInteger(allow_none=True)
    sat = NestedInteger(allow_none=True)
    satOff = NestedInteger(allow_none=True)
    satMod = NestedInteger(allow_none=True)
    lum = NestedInteger(allow_none=True)
    lumOff = NestedInteger(allow_none=True)
    lumMod = NestedInteger(allow_none=True)
    red = NestedInteger(allow_none=True)
    redOff = NestedInteger(allow_none=True)
    redMod = NestedInteger(allow_none=True)
    green = NestedInteger(allow_none=True)
    greenOff = NestedInteger(allow_none=True)
    greenMod = NestedInteger(allow_none=True)
    blue = NestedInteger(allow_none=True)
    blueOff = NestedInteger(allow_none=True)
    blueMod = NestedInteger(allow_none=True)
    gamma = Typed(expected_type=Transform, allow_none=True)
    invGamma = Typed(expected_type=Transform, allow_none=True)

    val = Set(values=([
        'scrollBar', 'background', 'activeCaption', 'inactiveCaption', 'menu',
        'window', 'windowFrame', 'menuText', 'windowText', 'captionText',
        'activeBorder', 'inactiveBorder', 'appWorkspace', 'highlight',
        'highlightText', 'btnFace', 'btnShadow', 'grayText', 'btnText',
        'inactiveCaptionText', 'btnHighlight', '3dDkShadow', '3dLight',
        'infoText', 'infoBk', 'hotLight', 'gradientActiveCaption',
        'gradientInactiveCaption', 'menuHighlight', 'menuBar'
    ]))
    lastClr = RGB(allow_none=True)

    __elements__ = ('tint', 'shade', 'comp', 'inv', 'gray', "alpha",
                    "alphaOff", "alphaMod", "hue", "hueOff", "hueMod",
                    "hueOff", "sat", "satOff", "satMod", "lum", "lumOff",
                    "lumMod", "red", "redOff", "redMod", "green", "greenOff",
                    "greenMod", "blue", "blueOff", "blueMod", "gamma",
                    "invGamma")

    def __init__(self,
                 val="windowText",
                 lastClr=None,
                 tint=None,
                 shade=None,
                 comp=None,
                 inv=None,
                 gray=None,
                 alpha=None,
                 alphaOff=None,
                 alphaMod=None,
                 hue=None,
                 hueOff=None,
                 hueMod=None,
                 sat=None,
                 satOff=None,
                 satMod=None,
                 lum=None,
                 lumOff=None,
                 lumMod=None,
                 red=None,
                 redOff=None,
                 redMod=None,
                 green=None,
                 greenOff=None,
                 greenMod=None,
                 blue=None,
                 blueOff=None,
                 blueMod=None,
                 gamma=None,
                 invGamma=None):
        self.val = val
        self.lastClr = lastClr
        self.tint = tint
        self.shade = shade
        self.comp = comp
        self.inv = inv
        self.gray = gray
        self.alpha = alpha
        self.alphaOff = alphaOff
        self.alphaMod = alphaMod
        self.hue = hue
        self.hueOff = hueOff
        self.hueMod = hueMod
        self.sat = sat
        self.satOff = satOff
        self.satMod = satMod
        self.lum = lum
        self.lumOff = lumOff
        self.lumMod = lumMod
        self.red = red
        self.redOff = redOff
        self.redMod = redMod
        self.green = green
        self.greenOff = greenOff
        self.greenMod = greenMod
        self.blue = blue
        self.blueOff = blueOff
        self.blueMod = blueMod
        self.gamma = gamma
        self.invGamma = invGamma
Esempio n. 28
0
class PresetGeometry2D(Serialisable):

    namespace = DRAWING_NS

    prst = Set(values=([
        'line', 'lineInv', 'triangle', 'rtTriangle', 'rect', 'diamond',
        'parallelogram', 'trapezoid', 'nonIsoscelesTrapezoid', 'pentagon',
        'hexagon', 'heptagon', 'octagon', 'decagon', 'dodecagon', 'star4',
        'star5', 'star6', 'star7', 'star8', 'star10', 'star12', 'star16',
        'star24', 'star32', 'roundRect', 'round1Rect', 'round2SameRect',
        'round2DiagRect', 'snipRoundRect', 'snip1Rect', 'snip2SameRect',
        'snip2DiagRect', 'plaque', 'ellipse', 'teardrop', 'homePlate',
        'chevron', 'pieWedge', 'pie', 'blockArc', 'donut', 'noSmoking',
        'rightArrow', 'leftArrow', 'upArrow', 'downArrow', 'stripedRightArrow',
        'notchedRightArrow', 'bentUpArrow', 'leftRightArrow', 'upDownArrow',
        'leftUpArrow', 'leftRightUpArrow', 'quadArrow', 'leftArrowCallout',
        'rightArrowCallout', 'upArrowCallout', 'downArrowCallout',
        'leftRightArrowCallout', 'upDownArrowCallout', 'quadArrowCallout',
        'bentArrow', 'uturnArrow', 'circularArrow', 'leftCircularArrow',
        'leftRightCircularArrow', 'curvedRightArrow', 'curvedLeftArrow',
        'curvedUpArrow', 'curvedDownArrow', 'swooshArrow', 'cube', 'can',
        'lightningBolt', 'heart', 'sun', 'moon', 'smileyFace',
        'irregularSeal1', 'irregularSeal2', 'foldedCorner', 'bevel', 'frame',
        'halfFrame', 'corner', 'diagStripe', 'chord', 'arc', 'leftBracket',
        'rightBracket', 'leftBrace', 'rightBrace', 'bracketPair', 'bracePair',
        'straightConnector1', 'bentConnector2', 'bentConnector3',
        'bentConnector4', 'bentConnector5', 'curvedConnector2',
        'curvedConnector3', 'curvedConnector4', 'curvedConnector5', 'callout1',
        'callout2', 'callout3', 'accentCallout1', 'accentCallout2',
        'accentCallout3', 'borderCallout1', 'borderCallout2', 'borderCallout3',
        'accentBorderCallout1', 'accentBorderCallout2', 'accentBorderCallout3',
        'wedgeRectCallout', 'wedgeRoundRectCallout', 'wedgeEllipseCallout',
        'cloudCallout', 'cloud', 'ribbon', 'ribbon2', 'ellipseRibbon',
        'ellipseRibbon2', 'leftRightRibbon', 'verticalScroll',
        'horizontalScroll', 'wave', 'doubleWave', 'plus', 'flowChartProcess',
        'flowChartDecision', 'flowChartInputOutput',
        'flowChartPredefinedProcess', 'flowChartInternalStorage',
        'flowChartDocument', 'flowChartMultidocument', 'flowChartTerminator',
        'flowChartPreparation', 'flowChartManualInput',
        'flowChartManualOperation', 'flowChartConnector',
        'flowChartPunchedCard', 'flowChartPunchedTape',
        'flowChartSummingJunction', 'flowChartOr', 'flowChartCollate',
        'flowChartSort', 'flowChartExtract', 'flowChartMerge',
        'flowChartOfflineStorage', 'flowChartOnlineStorage',
        'flowChartMagneticTape', 'flowChartMagneticDisk',
        'flowChartMagneticDrum', 'flowChartDisplay', 'flowChartDelay',
        'flowChartAlternateProcess', 'flowChartOffpageConnector',
        'actionButtonBlank', 'actionButtonHome', 'actionButtonHelp',
        'actionButtonInformation', 'actionButtonForwardNext',
        'actionButtonBackPrevious', 'actionButtonEnd', 'actionButtonBeginning',
        'actionButtonReturn', 'actionButtonDocument', 'actionButtonSound',
        'actionButtonMovie', 'gear6', 'gear9', 'funnel', 'mathPlus',
        'mathMinus', 'mathMultiply', 'mathDivide', 'mathEqual', 'mathNotEqual',
        'cornerTabs', 'squareTabs', 'plaqueTabs', 'chartX', 'chartStar',
        'chartPlus'
    ]))
    avLst = Typed(expected_type=GeomGuideList, allow_none=True)

    def __init__(
        self,
        prst=None,
        avLst=None,
    ):
        self.prst = prst
        self.avLst = avLst
Esempio n. 29
0
class PivotField(Serialisable):

    tagname = "pivotField"

    items = NestedSequence(expected_type=FieldItem, count=True)
    autoSortScope = Typed(expected_type=AutoSortScope, allow_none=True)
    extLst = Typed(expected_type=ExtensionList, allow_none=True)
    name = String(allow_none=True)
    axis = NoneSet(values=(['axisRow', 'axisCol', 'axisPage', 'axisValues']))
    dataField = Bool(allow_none=True)
    subtotalCaption = String(allow_none=True)
    showDropDowns = Bool(allow_none=True)
    hiddenLevel = Bool(allow_none=True)
    uniqueMemberProperty = String(allow_none=True)
    compact = Bool(allow_none=True)
    allDrilled = Bool(allow_none=True)
    numFmtId = Integer(allow_none=True)
    outline = Bool(allow_none=True)
    subtotalTop = Bool(allow_none=True)
    dragToRow = Bool(allow_none=True)
    dragToCol = Bool(allow_none=True)
    multipleItemSelectionAllowed = Bool(allow_none=True)
    dragToPage = Bool(allow_none=True)
    dragToData = Bool(allow_none=True)
    dragOff = Bool(allow_none=True)
    showAll = Bool(allow_none=True)
    insertBlankRow = Bool(allow_none=True)
    serverField = Bool(allow_none=True)
    insertPageBreak = Bool(allow_none=True)
    autoShow = Bool(allow_none=True)
    topAutoShow = Bool(allow_none=True)
    hideNewItems = Bool(allow_none=True)
    measureFilter = Bool(allow_none=True)
    includeNewItemsInFilter = Bool(allow_none=True)
    itemPageCount = Integer(allow_none=True)
    sortType = Set(values=(['manual', 'ascending', 'descending']))
    dataSourceSort = Bool(allow_none=True)
    nonAutoSortDefault = Bool(allow_none=True)
    rankBy = Integer(allow_none=True)
    defaultSubtotal = Bool(allow_none=True)
    sumSubtotal = Bool(allow_none=True)
    countASubtotal = Bool(allow_none=True)
    avgSubtotal = Bool(allow_none=True)
    maxSubtotal = Bool(allow_none=True)
    minSubtotal = Bool(allow_none=True)
    productSubtotal = Bool(allow_none=True)
    countSubtotal = Bool(allow_none=True)
    stdDevSubtotal = Bool(allow_none=True)
    stdDevPSubtotal = Bool(allow_none=True)
    varSubtotal = Bool(allow_none=True)
    varPSubtotal = Bool(allow_none=True)
    showPropCell = Bool(allow_none=True)
    showPropTip = Bool(allow_none=True)
    showPropAsCaption = Bool(allow_none=True)
    defaultAttributeDrillState = Bool(allow_none=True)

    __elements__ = (
        'items',
        'autoSortScope',
    )

    def __init__(
        self,
        items=(),
        autoSortScope=None,
        name=None,
        axis=None,
        dataField=None,
        subtotalCaption=None,
        showDropDowns=True,
        hiddenLevel=None,
        uniqueMemberProperty=None,
        compact=True,
        allDrilled=None,
        numFmtId=None,
        outline=True,
        subtotalTop=True,
        dragToRow=True,
        dragToCol=True,
        multipleItemSelectionAllowed=None,
        dragToPage=True,
        dragToData=True,
        dragOff=True,
        showAll=True,
        insertBlankRow=None,
        serverField=None,
        insertPageBreak=None,
        autoShow=None,
        topAutoShow=True,
        hideNewItems=None,
        measureFilter=None,
        includeNewItemsInFilter=None,
        itemPageCount=10,
        sortType="manual",
        dataSourceSort=None,
        nonAutoSortDefault=None,
        rankBy=None,
        defaultSubtotal=True,
        sumSubtotal=None,
        countASubtotal=None,
        avgSubtotal=None,
        maxSubtotal=None,
        minSubtotal=None,
        productSubtotal=None,
        countSubtotal=None,
        stdDevSubtotal=None,
        stdDevPSubtotal=None,
        varSubtotal=None,
        varPSubtotal=None,
        showPropCell=None,
        showPropTip=None,
        showPropAsCaption=None,
        defaultAttributeDrillState=None,
        extLst=None,
    ):
        self.items = items
        self.autoSortScope = autoSortScope
        self.name = name
        self.axis = axis
        self.dataField = dataField
        self.subtotalCaption = subtotalCaption
        self.showDropDowns = showDropDowns
        self.hiddenLevel = hiddenLevel
        self.uniqueMemberProperty = uniqueMemberProperty
        self.compact = compact
        self.allDrilled = allDrilled
        self.numFmtId = numFmtId
        self.outline = outline
        self.subtotalTop = subtotalTop
        self.dragToRow = dragToRow
        self.dragToCol = dragToCol
        self.multipleItemSelectionAllowed = multipleItemSelectionAllowed
        self.dragToPage = dragToPage
        self.dragToData = dragToData
        self.dragOff = dragOff
        self.showAll = showAll
        self.insertBlankRow = insertBlankRow
        self.serverField = serverField
        self.insertPageBreak = insertPageBreak
        self.autoShow = autoShow
        self.topAutoShow = topAutoShow
        self.hideNewItems = hideNewItems
        self.measureFilter = measureFilter
        self.includeNewItemsInFilter = includeNewItemsInFilter
        self.itemPageCount = itemPageCount
        self.sortType = sortType
        self.dataSourceSort = dataSourceSort
        self.nonAutoSortDefault = nonAutoSortDefault
        self.rankBy = rankBy
        self.defaultSubtotal = defaultSubtotal
        self.sumSubtotal = sumSubtotal
        self.countASubtotal = countASubtotal
        self.avgSubtotal = avgSubtotal
        self.maxSubtotal = maxSubtotal
        self.minSubtotal = minSubtotal
        self.productSubtotal = productSubtotal
        self.countSubtotal = countSubtotal
        self.stdDevSubtotal = stdDevSubtotal
        self.stdDevPSubtotal = stdDevPSubtotal
        self.varSubtotal = varSubtotal
        self.varPSubtotal = varPSubtotal
        self.showPropCell = showPropCell
        self.showPropTip = showPropTip
        self.showPropAsCaption = showPropAsCaption
        self.defaultAttributeDrillState = defaultAttributeDrillState
Esempio n. 30
0
class PivotFilter(Serialisable):

    tagname = "filter"

    fld = Integer()
    mpFld = Integer(allow_none=True)
    type = Set(values=([
        'unknown', 'count', 'percent', 'sum', 'captionEqual',
        'captionNotEqual', 'captionBeginsWith', 'captionNotBeginsWith',
        'captionEndsWith', 'captionNotEndsWith', 'captionContains',
        'captionNotContains', 'captionGreaterThan',
        'captionGreaterThanOrEqual', 'captionLessThan',
        'captionLessThanOrEqual', 'captionBetween', 'captionNotBetween',
        'valueEqual', 'valueNotEqual', 'valueGreaterThan',
        'valueGreaterThanOrEqual', 'valueLessThan', 'valueLessThanOrEqual',
        'valueBetween', 'valueNotBetween', 'dateEqual', 'dateNotEqual',
        'dateOlderThan', 'dateOlderThanOrEqual', 'dateNewerThan',
        'dateNewerThanOrEqual', 'dateBetween', 'dateNotBetween', 'tomorrow',
        'today', 'yesterday', 'nextWeek', 'thisWeek', 'lastWeek', 'nextMonth',
        'thisMonth', 'lastMonth', 'nextQuarter', 'thisQuarter', 'lastQuarter',
        'nextYear', 'thisYear', 'lastYear', 'yearToDate', 'Q1', 'Q2', 'Q3',
        'Q4', 'M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'M8', 'M9', 'M10',
        'M11', 'M12'
    ]))
    evalOrder = Integer(allow_none=True)
    id = Integer()
    iMeasureHier = Integer(allow_none=True)
    iMeasureFld = Integer(allow_none=True)
    name = String(allow_none=True)
    description = String(allow_none=True)
    stringValue1 = String(allow_none=True)
    stringValue2 = String(allow_none=True)
    autoFilter = Typed(expected_type=AutoFilter, )
    extLst = Typed(expected_type=ExtensionList, allow_none=True)

    __elements__ = ('autoFilter', )

    def __init__(
        self,
        fld=None,
        mpFld=None,
        type=None,
        evalOrder=None,
        id=None,
        iMeasureHier=None,
        iMeasureFld=None,
        name=None,
        description=None,
        stringValue1=None,
        stringValue2=None,
        autoFilter=None,
        extLst=None,
    ):
        self.fld = fld
        self.mpFld = mpFld
        self.type = type
        self.evalOrder = evalOrder
        self.id = id
        self.iMeasureHier = iMeasureHier
        self.iMeasureFld = iMeasureFld
        self.name = name
        self.description = description
        self.stringValue1 = stringValue1
        self.stringValue2 = stringValue2
        self.autoFilter = autoFilter