class CT_ColorScale(BaseOxmlElement): """ Complex type (sml-sheet.xsd) """ cfvo = ZeroOrMore('ssml:cfvo') # Conditional Format Value Object color = ZeroOrMore('ssml:color') # Color Gradiant Interpolation
class CT_CfRule(BaseOxmlElement): """ Complex type (sml-sheet.xsd) """ formula = ZeroOrMore('ssml:formula') # Formula colorScale = ZeroOrOne('ssml:colorScale') # Color Scale dataBar = ZeroOrOne('ssml:dataBar') # Data Bar iconSet = ZeroOrOne('ssml:iconSet') # Icon Set extLst = ZeroOrMore('ssml:extLst') # None type = OptionalAttribute('type', ST_CfType) # Type dxfId = OptionalAttribute('dxfId', ST_DxfId) # Differential Formatting Id priority = RequiredAttribute('priority', XsdInt) # Priority stopIfTrue = OptionalAttribute('stopIfTrue', XsdBoolean, False) # Stop If True aboveAverage = OptionalAttribute('aboveAverage', XsdBoolean, True) # Above Or Below Average percent = OptionalAttribute('percent', XsdBoolean, False) # Top 10 Percent bottom = OptionalAttribute('bottom', XsdBoolean, False) # Bottom N operator = OptionalAttribute('operator', ST_ConditionalFormattingOperator) # Operator text = OptionalAttribute('text', XsdString) # Text timePeriod = OptionalAttribute('timePeriod', ST_TimePeriod) # Time Period rank = OptionalAttribute('rank', XsdUnsignedInt) # Rank stdDev = OptionalAttribute('stdDev', XsdInt) # StdDev equalAverage = OptionalAttribute('equalAverage', XsdBoolean, False) # Equal Average
class CT_Comment(BaseOxmlElement): p = ZeroOrMore('w:p', successors=('w:altChunk', )) tbl = ZeroOrMore('w:tbl', successors=('w:altChunk', )) altChunk = ZeroOrMore('w:altChunk', successors=()) id = RequiredAttribute('w:id', ST_DecimalNumber) author = RequiredAttribute('w:author', ST_String)
class CT_PivotAreaReference(BaseOxmlElement): """ Complex type (sml-pivotTableShared.xsd) """ x = ZeroOrMore('ssml:x') # Field Item extLst = ZeroOrMore('ssml:extLst') # None field = OptionalAttribute('field', XsdUnsignedInt) # Field Index count = OptionalAttribute('count', XsdUnsignedInt) # Item Index Count selected = OptionalAttribute('selected', XsdBoolean) # Selected byPosition = OptionalAttribute('byPosition', XsdBoolean) # Positional Reference relative = OptionalAttribute('relative', XsdBoolean) # Relative Reference defaultSubtotal = OptionalAttribute('defaultSubtotal', XsdBoolean) # Include Default Filter sumSubtotal = OptionalAttribute('sumSubtotal', XsdBoolean) # Include Sum Filter countASubtotal = OptionalAttribute('countASubtotal', XsdBoolean) # Include CountA Filter avgSubtotal = OptionalAttribute('avgSubtotal', XsdBoolean) # Include Average Filter maxSubtotal = OptionalAttribute('maxSubtotal', XsdBoolean) # Include Maximum Filter minSubtotal = OptionalAttribute('minSubtotal', XsdBoolean) # Include Minimum Filter productSubtotal = OptionalAttribute('productSubtotal', XsdBoolean) # Include Product Filter countSubtotal = OptionalAttribute('countSubtotal', XsdBoolean) # Include Count Subtotal stdDevSubtotal = OptionalAttribute('stdDevSubtotal', XsdBoolean) # Include StdDev Filter stdDevPSubtotal = OptionalAttribute('stdDevPSubtotal', XsdBoolean) # Include StdDevP Filter varSubtotal = OptionalAttribute('varSubtotal', XsdBoolean) # Include Var Filter varPSubtotal = OptionalAttribute('varPSubtotal', XsdBoolean) # Include VarP Filter
class CT_Macrosheet(BaseOxmlElement): """ Complex type (sml-sheet.xsd) """ sheetPr = ZeroOrOne('ssml:sheetPr') # Sheet Properties dimension = ZeroOrOne('ssml:dimension') # Macro Sheet Dimensions sheetViews = ZeroOrOne('ssml:sheetViews') # Macro Sheet Views sheetFormatPr = ZeroOrOne('ssml:sheetFormatPr') # Sheet Format Properties cols = ZeroOrMore('ssml:cols') # Column Information sheetData = OneAndOnlyOne('ssml:sheetData') # Sheet Data sheetProtection = ZeroOrOne( 'ssml:sheetProtection') # Sheet Protection Options autoFilter = ZeroOrOne('ssml:autoFilter') # AutoFilter sortState = ZeroOrOne('ssml:sortState') # Sort State dataConsolidate = ZeroOrOne('ssml:dataConsolidate') # Data Consolidation customSheetViews = ZeroOrOne('ssml:customSheetViews') # Custom Sheet Views phoneticPr = ZeroOrOne('ssml:phoneticPr') # Phonetic Properties conditionalFormatting = ZeroOrMore( 'ssml:conditionalFormatting') # Conditional Formatting printOptions = ZeroOrOne('ssml:printOptions') # Print Options pageMargins = ZeroOrOne('ssml:pageMargins') # Page Margins pageSetup = ZeroOrOne('ssml:pageSetup') # Page Setup Settings headerFooter = ZeroOrOne('ssml:headerFooter') # Header Footer Settings rowBreaks = ZeroOrOne('ssml:rowBreaks') # Horizontal Page Breaks (Row) colBreaks = ZeroOrOne('ssml:colBreaks') # Vertical Page Breaks customProperties = ZeroOrOne('ssml:customProperties') # Custom Properties drawing = ZeroOrOne('ssml:drawing') # Drawing legacyDrawing = ZeroOrOne('ssml:legacyDrawing') # Legacy Drawing Reference legacyDrawingHF = ZeroOrOne( 'ssml:legacyDrawingHF') # Legacy Drawing Header Footer picture = ZeroOrOne('ssml:picture') # Background Image oleObjects = ZeroOrOne('ssml:oleObjects') # OLE Objects extLst = ZeroOrMore('ssml:extLst') # Future Feature Data Storage Area
class CT_FtnEdn(BaseOxmlElement): p = ZeroOrMore('w:p', successors=('w:altChunk', )) tbl = ZeroOrMore('w:tbl', successors=('w:altChunk', )) altChunk = ZeroOrMore('w:altChunk', successors=()) type = OptionalAttribute('w:type', ST_FtnEdn) id = RequiredAttribute('w:id', ST_DecimalNumber)
class CT_Filters(BaseOxmlElement): """ Complex type (sml-autoFilter.xsd) """ filter = ZeroOrMore('ssml:filter') # Filter dateGroupItem = ZeroOrMore('ssml:dateGroupItem') # Date Grouping blank = OptionalAttribute('blank', XsdBoolean, False) # Filter by Blank calendarType = OptionalAttribute('calendarType', ST_CalendarType, 'none') # Calendar Type
class CT_Hyperlink(BaseOxmlElement): # ほぼCT_Pと同じ r = ZeroOrMore('w:r') commentRangeStart = ZeroOrMore('w:commentRangeStart') commentRangeEnd = ZeroOrMore('w:commentRangeEnd') hyperlink = ZeroOrMore('w:hyperlink') tgtFrame = OptionalAttribute('w:tgtFrame', ST_String) tooltip = OptionalAttribute('w:tooltip', ST_String) docLocation = OptionalAttribute('w:docLocation', ST_String) history = OptionalAttribute('w:history', ST_OnOff) anchor = OptionalAttribute('w:anchor', ST_String) id = OptionalAttribute('r:id', ST_RelationshipId)
class CT_CustomChartsheetViews(BaseOxmlElement): """ Complex type (sml-sheet.xsd) """ customSheetView = ZeroOrMore( 'ssml:customSheetView') # Custom Chart Sheet View
class CT_Workbook(BaseOxmlElement): """ Complex type (sml-workbook.xsd) """ fileVersion = ZeroOrOne('ssml:fileVersion') # File Version fileSharing = ZeroOrOne('ssml:fileSharing') # File Sharing workbookPr = ZeroOrOne('ssml:workbookPr') # Workbook Properties workbookProtection = ZeroOrOne( 'ssml:workbookProtection') # Workbook Protection bookViews = ZeroOrOne('ssml:bookViews') # Workbook Views sheets = OneAndOnlyOne('ssml:sheets') # Sheets functionGroups = ZeroOrOne('ssml:functionGroups') # Function Groups externalReferences = ZeroOrOne( 'ssml:externalReferences') # External References definedNames = ZeroOrOne('ssml:definedNames') # Defined Names calcPr = ZeroOrOne('ssml:calcPr') # Calculation Properties oleSize = ZeroOrOne('ssml:oleSize') # OLE Size customWorkbookViews = ZeroOrOne( 'ssml:customWorkbookViews') # Custom Workbook Views pivotCaches = ZeroOrOne('ssml:pivotCaches') # PivotCaches smartTagPr = ZeroOrOne('ssml:smartTagPr') # Smart Tag Properties smartTagTypes = ZeroOrOne('ssml:smartTagTypes') # Smart Tag Types webPublishing = ZeroOrOne( 'ssml:webPublishing') # Web Publishing Properties fileRecoveryPr = ZeroOrMore( 'ssml:fileRecoveryPr') # File Recovery Properties webPublishObjects = ZeroOrOne( 'ssml:webPublishObjects') # Web Publish Objects extLst = ZeroOrOne('ssml:extLst') # Future Feature Data Storage Area
class CT_SST(BaseOxmlElement): si = ZeroOrMore('ssml:si') extLst = ZeroOrOne('ssml:extLst') # None count = OptionalAttribute('count', XsdUnsignedInt) # String Count uniqueCount = OptionalAttribute('uniqueCount', XsdUnsignedInt) # Unique String Count
class CT_Num(BaseOxmlElement): """ ``<w:num>`` element, which represents a concrete list definition instance, having a required child <w:abstractNumId> that references an abstract numbering definition that defines most of the formatting details. """ abstractNumId = OneAndOnlyOne('w:abstractNumId') lvlOverride = ZeroOrMore('w:lvlOverride') numId = RequiredAttribute('w:numId', ST_DecimalNumber) def add_lvlOverride(self, ilvl): """ Return a newly added CT_NumLvl (<w:lvlOverride>) element having its ``ilvl`` attribute set to *ilvl*. """ return self._add_lvlOverride(ilvl=ilvl) @classmethod def new(cls, num_id, abstractNum_id): """ Return a new ``<w:num>`` element having numId of *num_id* and having a ``<w:abstractNumId>`` child with val attribute set to *abstractNum_id*. """ num = OxmlElement('w:num') num.numId = num_id abstractNumId = CT_DecimalNumber.new('w:abstractNumId', abstractNum_id) num.append(abstractNumId) return num
class CT_Comments(BaseOxmlElement): """ ``<w:num>`` element, which represents a concrete list definition instance, having a required child <w:abstractNumId> that references an abstract numbering definition that defines most of the formatting details. """ comment = ZeroOrMore('w:comment', successors=())
class CT_SheetView(BaseOxmlElement): """ Complex type (sml-sheet.xsd) """ pane = ZeroOrOne('ssml:pane') # View Pane selection = ZeroOrMore('ssml:selection') # Selection pivotSelection = ZeroOrMore('ssml:pivotSelection') # PivotTable Selection extLst = ZeroOrOne('ssml:extLst') # Future Feature Data Storage Area windowProtection = OptionalAttribute('windowProtection', XsdBoolean, False) # Window Protection showFormulas = OptionalAttribute('showFormulas', XsdBoolean, False) # Show Formulas showGridLines = OptionalAttribute('showGridLines', XsdBoolean, True) # Show Grid Lines showRowColHeaders = OptionalAttribute('showRowColHeaders', XsdBoolean, True) # Show Headers showZeros = OptionalAttribute('showZeros', XsdBoolean, True) # Show Zero Values rightToLeft = OptionalAttribute('rightToLeft', XsdBoolean, False) # Right To Left tabSelected = OptionalAttribute('tabSelected', XsdBoolean, False) # Sheet Tab Selected showRuler = OptionalAttribute('showRuler', XsdBoolean, True) # Show Ruler showOutlineSymbols = OptionalAttribute('showOutlineSymbols', XsdBoolean, True) # Show Outline Symbols defaultGridColor = OptionalAttribute('defaultGridColor', XsdBoolean, True) # Default Grid Color showWhiteSpace = OptionalAttribute('showWhiteSpace', XsdBoolean, True) # Show White Space view = OptionalAttribute('view', ST_SheetViewType, 'normal') # View Type topLeftCell = OptionalAttribute('topLeftCell', ST_CellRef) # Top Left Visible Cell colorId = OptionalAttribute('colorId', XsdUnsignedInt, 64) # Color Id zoomScale = OptionalAttribute('zoomScale', XsdUnsignedInt, 100) # Zoom Scale zoomScaleNormal = OptionalAttribute('zoomScaleNormal', XsdUnsignedInt, 0) # Zoom Scale Normal View zoomScaleSheetLayoutView = OptionalAttribute( 'zoomScaleSheetLayoutView', XsdUnsignedInt, 0) # Zoom Scale Page Break Preview zoomScalePageLayoutView = OptionalAttribute( 'zoomScalePageLayoutView', XsdUnsignedInt, 0) # Zoom Scale Page Layout View workbookViewId = RequiredAttribute('workbookViewId', XsdUnsignedInt) # Workbook View Index
class CT_CustomFilters(BaseOxmlElement): """ Complex type (sml-autoFilter.xsd) """ customFilter = ZeroOrMore('ssml:customFilter') # Custom Filter Criteria and_ = OptionalAttribute('and', XsdBoolean, False) # And
class CT_Borders(BaseOxmlElement): """ Complex type (sml-styles.xsd) """ border = ZeroOrMore('ssml:border') # Border count = OptionalAttribute('count', XsdUnsignedInt) # Border Count
class CT_Dxfs(BaseOxmlElement): """ Complex type (sml-styles.xsd) """ dxf = ZeroOrMore('ssml:dxf') # Formatting count = OptionalAttribute('count', XsdUnsignedInt) # Format Count
class CT_Fills(BaseOxmlElement): """ Complex type (sml-styles.xsd) """ fill = ZeroOrMore('ssml:fill') # Fill count = OptionalAttribute('count', XsdUnsignedInt) # Fill Count
class CT_NumFmts(BaseOxmlElement): """ Complex type (sml-styles.xsd) """ numFmt = ZeroOrMore('ssml:numFmt') # Number Formats count = OptionalAttribute('count', XsdUnsignedInt) # Number Format Count
class CT_TableParts(BaseOxmlElement): """ Complex type (sml-sheet.xsd) """ tablePart = ZeroOrMore('ssml:tablePart') # Table Part count = OptionalAttribute('count', XsdUnsignedInt) # Count
class CT_Fonts(BaseOxmlElement): """ Complex type (sml-styles.xsd) """ font = ZeroOrMore('ssml:font') # Font count = OptionalAttribute('count', XsdUnsignedInt) # Font Count
class CT_PivotAreaReferences(BaseOxmlElement): """ Complex type (sml-pivotTableShared.xsd) """ reference = ZeroOrMore('ssml:reference') # Reference count = OptionalAttribute('count', XsdUnsignedInt) # Pivot Filter Count
class CT_Worksheet(BaseOxmlElement): """ Complex type (sml-sheet.xsd) """ sheetPr = ZeroOrOne('ssml:sheetPr') # Worksheet Properties dimension = ZeroOrOne('ssml:dimension') # Worksheet Dimensions sheetViews = ZeroOrOne('ssml:sheetViews') # Sheet Views sheetFormatPr = ZeroOrOne('ssml:sheetFormatPr') # Sheet Format Properties cols = ZeroOrMore('ssml:cols') # Column Information sheetData = OneAndOnlyOne('ssml:sheetData') # Sheet Data sheetCalcPr = ZeroOrOne('ssml:sheetCalcPr') # Sheet Calculation Properties sheetProtection = ZeroOrOne('ssml:sheetProtection') # Sheet Protection protectedRanges = ZeroOrOne('ssml:protectedRanges') # Protected Ranges scenarios = ZeroOrOne('ssml:scenarios') # Scenarios autoFilter = ZeroOrOne('ssml:autoFilter') # AutoFilter sortState = ZeroOrOne('ssml:sortState') # Sort State dataConsolidate = ZeroOrOne('ssml:dataConsolidate') # Data Consolidate customSheetViews = ZeroOrOne('ssml:customSheetViews') # Custom Sheet Views mergeCells = ZeroOrOne('ssml:mergeCells') # Merge Cells phoneticPr = ZeroOrOne('ssml:phoneticPr') # Phonetic Properties conditionalFormatting = ZeroOrMore( 'ssml:conditionalFormatting') # Conditional Formatting dataValidations = ZeroOrOne('ssml:dataValidations') # Data Validations hyperlinks = ZeroOrOne('ssml:hyperlinks') # Hyperlinks printOptions = ZeroOrOne('ssml:printOptions') # Print Options pageMargins = ZeroOrOne('ssml:pageMargins') # Page Margins pageSetup = ZeroOrOne('ssml:pageSetup') # Page Setup Settings headerFooter = ZeroOrOne('ssml:headerFooter') # Header and Footer Settings rowBreaks = ZeroOrOne('ssml:rowBreaks') # Horizontal Page Breaks colBreaks = ZeroOrOne('ssml:colBreaks') # Vertical Page Breaks customProperties = ZeroOrOne('ssml:customProperties') # Custom Properties cellWatches = ZeroOrOne('ssml:cellWatches') # Cell Watch Items ignoredErrors = ZeroOrOne('ssml:ignoredErrors') # Ignored Errors smartTags = ZeroOrOne('ssml:smartTags') # Smart Tags drawing = ZeroOrOne('ssml:drawing') # Drawing legacyDrawing = ZeroOrOne('ssml:legacyDrawing') # Legacy Drawing legacyDrawingHF = ZeroOrOne( 'ssml:legacyDrawingHF') # Legacy Drawing Header Footer picture = ZeroOrOne('ssml:picture') # Background Image oleObjects = ZeroOrOne('ssml:oleObjects') # None controls = ZeroOrOne('ssml:controls') # Embedded Controls webPublishItems = ZeroOrOne('ssml:webPublishItems') # Web Publishing Items tableParts = ZeroOrOne('ssml:tableParts') # Table Parts extLst = ZeroOrOne('ssml:extLst') # Future Feature Data Storage Area
class CT_DataRefs(BaseOxmlElement): """ Complex type (sml-sheet.xsd) """ dataRef = ZeroOrMore('ssml:dataRef') # Data Consolidation Reference count = OptionalAttribute( 'count', XsdUnsignedInt) # Data Consolidation Reference Count
class CT_FunctionGroups(BaseOxmlElement): """ Complex type (sml-workbook.xsd) """ functionGroup = ZeroOrMore('ssml:functionGroup') # Function Group builtInGroupCount = OptionalAttribute('builtInGroupCount', XsdUnsignedInt, 16) # Built-in Function Group Count
class CT_CellSmartTag(BaseOxmlElement): """ Complex type (sml-sheet.xsd) """ cellSmartTagPr = ZeroOrMore('ssml:cellSmartTagPr') # Smart Tag Properties type = RequiredAttribute('type', XsdUnsignedInt) # Smart Tag Type Index deleted = OptionalAttribute('deleted', XsdBoolean, False) # Deleted xmlBased = OptionalAttribute('xmlBased', XsdBoolean, False) # XML Based
class CT_AutoFilter(BaseOxmlElement): """ Complex type (sml-autoFilter.xsd) """ filterColumn = ZeroOrMore('ssml:filterColumn') # AutoFilter Column sortState = ZeroOrOne('ssml:sortState') # Sort State for Auto Filter extLst = ZeroOrOne('ssml:extLst') # None ref = OptionalAttribute('ref', ST_Ref) # Cell or Range Reference
class CT_PageBreak(BaseOxmlElement): """ Complex type (sml-sheet.xsd) """ brk = ZeroOrMore('ssml:brk') # Break count = OptionalAttribute('count', XsdUnsignedInt, 0) # Page Break Count manualBreakCount = OptionalAttribute('manualBreakCount', XsdUnsignedInt, 0) # Manual Break Count
class CT_Body(BaseOxmlElement): """ ``<w:body>``, the container element for the main document story in ``document.xml``. """ p = ZeroOrMore('w:p', successors=('w:sectPr', )) tbl = ZeroOrMore('w:tbl', successors=('w:sectPr', )) sectPr = ZeroOrOne('w:sectPr', successors=()) def add_section_break(self): """Return `w:sectPr` element for new section added at end of document. The last `w:sectPr` becomes the second-to-last, with the new `w:sectPr` being an exact clone of the previous one, except that all header and footer references are removed (and are therefore now "inherited" from the prior section). A copy of the previously-last `w:sectPr` will now appear in a new `w:p` at the end of the document. The returned `w:sectPr` is the sentinel `w:sectPr` for the document (and as implemented, *is* the prior sentinel `w:sectPr` with headers and footers removed). """ # ---get the sectPr at file-end, which controls last section (sections[-1])--- sentinel_sectPr = self.get_or_add_sectPr() # ---add exact copy to new `w:p` element; that is now second-to last section--- self.add_p().set_sectPr(sentinel_sectPr.clone()) # ---remove any header or footer references from "new" last section--- for hdrftr_ref in sentinel_sectPr.xpath( "w:headerReference|w:footerReference"): sentinel_sectPr.remove(hdrftr_ref) # ---the sentinel `w:sectPr` now controls the new last section--- return sentinel_sectPr def clear_content(self): """ Remove all content child elements from this <w:body> element. Leave the <w:sectPr> element if it is present. """ if self.sectPr is not None: content_elms = self[:-1] else: content_elms = self[:] for content_elm in content_elms: self.remove(content_elm)
class CT_TableStyle(BaseOxmlElement): """ Complex type (sml-styles.xsd) """ tableStyleElement = ZeroOrMore('ssml:tableStyleElement') # Table Style name = RequiredAttribute('name', XsdString) # Table Style Name pivot = OptionalAttribute('pivot', XsdBoolean, True) # Pivot Style table = OptionalAttribute('table', XsdBoolean, True) # Table count = OptionalAttribute('count', XsdUnsignedInt) # Table Style Count