private TextParagraphPropertiesType getParagraphPropFromTextListStyle(OpenXmlCompositeElement listStyleType, int level) { if (listStyleType != null) { if (listStyleType is TextListStyleType) { TextListStyleType parPropType = (TextListStyleType)listStyleType; switch (level) { case 0: return(parPropType.Level1ParagraphProperties); case 1: return(parPropType.Level2ParagraphProperties); case 2: return(parPropType.Level3ParagraphProperties); case 3: return(parPropType.Level4ParagraphProperties); case 4: return(parPropType.Level5ParagraphProperties); case 5: return(parPropType.Level6ParagraphProperties); case 6: return(parPropType.Level7ParagraphProperties); case 7: return(parPropType.Level8ParagraphProperties); case 8: return(parPropType.Level9ParagraphProperties); default: return(parPropType.Level1ParagraphProperties); } } else if (listStyleType is ListStyle) { ListStyle parPropType = (ListStyle)listStyleType; switch (level) { case 0: return(parPropType.Level1ParagraphProperties); case 1: return(parPropType.Level2ParagraphProperties); case 2: return(parPropType.Level3ParagraphProperties); case 3: return(parPropType.Level4ParagraphProperties); case 4: return(parPropType.Level5ParagraphProperties); case 5: return(parPropType.Level6ParagraphProperties); case 6: return(parPropType.Level7ParagraphProperties); case 7: return(parPropType.Level8ParagraphProperties); case 8: return(parPropType.Level9ParagraphProperties); default: return(parPropType.Level1ParagraphProperties); } } } return(null); }
public void SetParagraphProperties(Paragraph paragraph, SlidePart slidePart, DocumentFormat.OpenXml.Drawing.ListStyle shapeListStyleMaster, DocumentFormat.OpenXml.Drawing.ListStyle shapeListStyleLayout) { TextListStyleType listStyleType = this.slide.defaultTextStyle; if (slide.textStyles != null) { if (placeholder != null) { if (placeholder.Type.Value.Equals(PlaceholderValues.Body) || placeholder.Type.Value.Equals(PlaceholderValues.SubTitle)) { listStyleType = slide.textStyles.BodyStyle; } else if (placeholder.Type.Value.Equals(PlaceholderValues.Title) || placeholder.Type.Value.Equals(PlaceholderValues.CenteredTitle)) { listStyleType = slide.textStyles.TitleStyle; } else { listStyleType = slide.textStyles.OtherStyle; } } //Check what should we add here for all placeholder values. //Should we take it by placeholder value or there is another property? } TextParagraphPropertiesType baseProperties = getParagraphPropFromTextListStyle(listStyleType, Level); TextParagraphPropertiesType basePropertiesMaster = getParagraphPropFromTextListStyle(shapeListStyleMaster, Level); TextParagraphPropertiesType basePropertiesLayout = getParagraphPropFromTextListStyle(shapeListStyleLayout, Level); defaultRunProperties = new PPTRunProperties(slide); if (baseProperties != null) { this.FillParagraphProperties(baseProperties, slidePart); } if (basePropertiesMaster != null) { this.FillParagraphProperties(basePropertiesMaster, slidePart); } if (basePropertiesLayout != null) { this.FillParagraphProperties(basePropertiesLayout, slidePart); } if (paragraph.ParagraphProperties != null) { this.FillParagraphProperties(paragraph.ParagraphProperties, slidePart); } }