class DateTimeField(Serialisable): tagname = "d" x = Sequence(expected_type=Index) v = DateTime() u = Bool(allow_none=True) f = Bool(allow_none=True) c = String(allow_none=True) cp = Integer(allow_none=True) __elements__ = ('x', ) def __init__( self, x=(), v=None, u=None, f=None, c=None, cp=None, ): self.x = x self.v = v self.u = u self.f = f self.c = c self.cp = cp
class PivotTableStyle(Serialisable): tagname = "pivotTableStyleInfo" name = String(allow_none=True) showRowHeaders = Bool() showColHeaders = Bool() showRowStripes = Bool() showColStripes = Bool() showLastColumn = Bool() def __init__( self, name=None, showRowHeaders=None, showColHeaders=None, showRowStripes=None, showColStripes=None, showLastColumn=None, ): self.name = name self.showRowHeaders = showRowHeaders self.showColHeaders = showColHeaders self.showRowStripes = showRowStripes self.showColStripes = showColStripes self.showLastColumn = showLastColumn
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 MemberProperty(Serialisable): tagname = "mps" name = String(allow_none=True) showCell = Bool(allow_none=True) showTip = Bool(allow_none=True) showAsCaption = Bool(allow_none=True) nameLen = Integer(allow_none=True) pPos = Integer(allow_none=True) pLen = Integer(allow_none=True) level = Integer(allow_none=True) field = Integer() def __init__( self, name=None, showCell=None, showTip=None, showAsCaption=None, nameLen=None, pPos=None, pLen=None, level=None, field=None, ): self.name = name self.showCell = showCell self.showTip = showTip self.showAsCaption = showAsCaption self.nameLen = nameLen self.pPos = pPos self.pLen = pLen self.level = level self.field = field
class RowDimension(Dimension): """Information about the display properties of a row.""" __fields__ = Dimension.__fields__ + ('ht', 'customFormat', 'customHeight', 's', 'thickBot', 'thickTop') r = Alias('index') s = Alias('style_id') ht = Float(allow_none=True) height = Alias('ht') thickBot = Bool() thickTop = Bool() def __init__( self, worksheet, index=0, ht=None, customHeight=None, # do not write s=None, customFormat=None, # do not write hidden=False, outlineLevel=0, outline_level=None, collapsed=False, visible=None, height=None, r=None, spans=None, thickBot=None, thickTop=None, **kw): if r is not None: index = r if height is not None: ht = height self.ht = ht if visible is not None: hidden = not visible if outline_level is not None: outlineLevel = outline_level self.thickBot = thickBot self.thickTop = thickTop super(RowDimension, self).__init__(index, hidden, outlineLevel, collapsed, worksheet, style=s) @property def customFormat(self): """Always true if there is a style for the row""" return self.has_style @property def customHeight(self): """Always true if there is a height for the row""" return self.ht is not None
class Alignment(Serialisable): """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, mergeCell=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 # mergeCell is vestigial 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 PageSetupProperties(Serialisable): tagname = "pageSetUpPr" autoPageBreaks = Bool(allow_none=True) fitToPage = Bool(allow_none=True) def __init__(self, autoPageBreaks=None, fitToPage=None): self.autoPageBreaks = autoPageBreaks self.fitToPage = fitToPage
class PivotHierarchy(Serialisable): tagname = "pivotHierarchy" outline = Bool() multipleItemSelectionAllowed = Bool() subtotalTop = Bool() showInFieldList = Bool() dragToRow = Bool() dragToCol = Bool() dragToPage = Bool() dragToData = Bool() dragOff = Bool() includeNewItemsInFilter = Bool() caption = String(allow_none=True) mps = NestedSequence(expected_type=MemberProperty, count=True) members = Typed(expected_type=MemberList, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ( 'mps', 'members', ) def __init__( self, outline=None, multipleItemSelectionAllowed=None, subtotalTop=None, showInFieldList=None, dragToRow=None, dragToCol=None, dragToPage=None, dragToData=None, dragOff=None, includeNewItemsInFilter=None, caption=None, mps=(), members=None, extLst=None, ): self.outline = outline self.multipleItemSelectionAllowed = multipleItemSelectionAllowed self.subtotalTop = subtotalTop self.showInFieldList = showInFieldList self.dragToRow = dragToRow self.dragToCol = dragToCol self.dragToPage = dragToPage self.dragToData = dragToData self.dragOff = dragOff self.includeNewItemsInFilter = includeNewItemsInFilter self.caption = caption self.mps = mps self.members = members self.extLst = extLst
class Protection(Serialisable): """Protection options for use in styles.""" tagname = "protection" locked = Bool() hidden = Bool() def __init__(self, locked=True, hidden=False): self.locked = locked self.hidden = hidden
class AnchorClientData(Serialisable): fLocksWithSheet = Bool(allow_none=True) fPrintsWithSheet = Bool(allow_none=True) def __init__(self, fLocksWithSheet=None, fPrintsWithSheet=None, ): self.fLocksWithSheet = fLocksWithSheet self.fPrintsWithSheet = fPrintsWithSheet
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 FilterColumn(Serialisable): tagname = "filterColumn" colId = Integer() col_id = Alias('colId') hiddenButton = Bool(allow_none=True) showButton = Bool(allow_none=True) # some elements are choice filters = Typed(expected_type=Filters, allow_none=True) top10 = Typed(expected_type=Top10, allow_none=True) customFilters = Typed(expected_type=CustomFilters, allow_none=True) dynamicFilter = Typed(expected_type=DynamicFilter, allow_none=True) colorFilter = Typed(expected_type=ColorFilter, allow_none=True) iconFilter = Typed(expected_type=IconFilter, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('filters', 'top10', 'customFilters', 'dynamicFilter', 'colorFilter', 'iconFilter') def __init__( self, colId=None, hiddenButton=None, showButton=None, filters=None, top10=None, customFilters=None, dynamicFilter=None, colorFilter=None, iconFilter=None, extLst=None, blank=None, vals=None, ): self.colId = colId self.hiddenButton = hiddenButton self.showButton = showButton self.filters = filters self.top10 = top10 self.customFilters = customFilters self.dynamicFilter = dynamicFilter self.colorFilter = colorFilter self.iconFilter = iconFilter if blank is not None and self.filters: self.filters.blank = blank if vals is not None and self.filters: self.filters.filter = vals
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 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 FileSharing(Serialisable): tagname = "fileSharing" readOnlyRecommended = Bool(allow_none=True) userName = String(allow_none=True) reservationPassword = HexBinary(allow_none=True) algorithmName = String(allow_none=True) hashValue = HexBinary(allow_none=True) saltValue = HexBinary(allow_none=True) spinCount = Integer(allow_none=True) def __init__( self, readOnlyRecommended=None, userName=None, reservationPassword=None, algorithmName=None, hashValue=None, saltValue=None, spinCount=None, ): self.readOnlyRecommended = readOnlyRecommended self.userName = userName self.reservationPassword = reservationPassword self.algorithmName = algorithmName self.hashValue = hashValue self.saltValue = saltValue self.spinCount = spinCount
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 CalculatedMember(Serialisable): tagname = "calculatedMember" name = String() mdx = String() memberName = String() hierarchy = String() parent = String() solveOrder = Integer() set = Bool() extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = ('extLst', ) def __init__( self, name=None, mdx=None, memberName=None, hierarchy=None, parent=None, solveOrder=None, set=None, extLst=None, ): self.name = name self.mdx = mdx self.memberName = memberName self.hierarchy = hierarchy self.parent = parent self.solveOrder = solveOrder self.set = set self.extLst = extLst
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
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 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 WebPublishObject(Serialisable): tagname = "webPublishingObject" id = Integer() divId = 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, sourceObject=None, destinationFile=None, title=None, autoRepublish=None, ): self.id = id self.divId = divId self.sourceObject = sourceObject self.destinationFile = destinationFile self.title = title self.autoRepublish = autoRepublish
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 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 ObjectAnchor(Serialisable): moveWithCells = Bool(allow_none=True) sizeWithCells = Bool(allow_none=True) #z-order = Integer(allow_none=True) needs alias #from #to defs from xdr def __init__( self, moveWithCells=None, sizeWithCells=None, #z-order=None, ): self.moveWithCells = moveWithCells self.sizeWithCells = sizeWithCells
class Outline(Serialisable): tagname = "outlinePr" applyStyles = Bool(allow_none=True) summaryBelow = Bool(allow_none=True) summaryRight = Bool(allow_none=True) showOutlineSymbols = Bool(allow_none=True) def __init__(self, applyStyles=None, summaryBelow=None, summaryRight=None, showOutlineSymbols=None): self.applyStyles = applyStyles self.summaryBelow = summaryBelow self.summaryRight = summaryRight self.showOutlineSymbols = showOutlineSymbols
class Dimension(Strict, StyleableObject): """Information about the display properties of a row or column.""" __fields__ = ( 'hidden', 'outlineLevel', 'collapsed', ) index = Integer() hidden = Bool() outlineLevel = Integer(allow_none=True) outline_level = Alias('outlineLevel') collapsed = Bool() style = Alias('style_id') def __init__(self, index, hidden, outlineLevel, collapsed, worksheet, visible=True, style=None): super(Dimension, self).__init__(sheet=worksheet, style_array=style) self.index = index self.hidden = hidden self.outlineLevel = outlineLevel self.collapsed = collapsed def __iter__(self): for key in self.__fields__: value = getattr(self, key, None) if value: yield key, safe_string(value) def __copy__(self): cp = self.__new__(self.__class__) attrib = self.__dict__ attrib['worksheet'] = self.parent cp.__init__(**attrib) cp._style = copy(self._style) return cp
class NumFmt(Serialisable): formatCode = String() sourceLinked = Bool() def __init__(self, formatCode=None, sourceLinked=False ): self.formatCode = formatCode self.sourceLinked = sourceLinked
class Top10(Serialisable): tagname = "top10" top = Bool(allow_none=True) percent = Bool(allow_none=True) val = Float() filterVal = Float(allow_none=True) def __init__( self, top=None, percent=None, val=None, filterVal=None, ): self.top = top self.percent = percent self.val = val self.filterVal = filterVal
class BlurEffect(Serialisable): rad = Float() grow = Bool(allow_none=True) def __init__( self, rad=None, grow=None, ): self.rad = rad self.grow = grow
class GraphicFrameLocking(Serialisable): noGrp = Bool(allow_none=True) noDrilldown = Bool(allow_none=True) noSelect = Bool(allow_none=True) noChangeAspect = Bool(allow_none=True) noMove = Bool(allow_none=True) noResize = Bool(allow_none=True) extLst = Typed(expected_type=OfficeArtExtensionList, allow_none=True) def __init__( self, noGrp=None, noDrilldown=None, noSelect=None, noChangeAspect=None, noMove=None, noResize=None, extLst=None, ): self.noGrp = noGrp self.noDrilldown = noDrilldown self.noSelect = noSelect self.noChangeAspect = noChangeAspect self.noMove = noMove self.noResize = noResize self.extLst = extLst