none
Why is this text in PowerPoint white and centered? RRS feed

  • Question

  • I am working on a tool that reads PowerPoint files and parses the text formatting of its elements. It's working well on most elements, but failing on some PowerPoint files created with older versions. For example, I have a PowerPoint file with one element on one slide that renders in PowerPoint as white and centered but I don't understand why.

    Any help would be greatly appreciated!

    Here is the reflected code that generates the shape. It does not contain a ShapeStyle element and does not refer to a placeholder.

    using DocumentFormat.OpenXml.Presentation;
    using DocumentFormat.OpenXml;
    using A = DocumentFormat.OpenXml.Drawing;
    using A14 = DocumentFormat.OpenXml.Office2010.Drawing;
    
    namespace GeneratedCode
    {
        public class GeneratedClass
        {
            // Creates an Shape instance and adds its children.
            public Shape GenerateShape()
            {
                Shape shape1 = new Shape();
    
                NonVisualShapeProperties nonVisualShapeProperties1 = new NonVisualShapeProperties();
                NonVisualDrawingProperties nonVisualDrawingProperties1 = new NonVisualDrawingProperties(){ Id = (UInt32Value)33U, Name = "Rectangle 2" };
    
                NonVisualShapeDrawingProperties nonVisualShapeDrawingProperties1 = new NonVisualShapeDrawingProperties();
                A.ShapeLocks shapeLocks1 = new A.ShapeLocks();
    
                nonVisualShapeDrawingProperties1.Append(shapeLocks1);
                ApplicationNonVisualDrawingProperties applicationNonVisualDrawingProperties1 = new ApplicationNonVisualDrawingProperties();
    
                nonVisualShapeProperties1.Append(nonVisualDrawingProperties1);
                nonVisualShapeProperties1.Append(nonVisualShapeDrawingProperties1);
                nonVisualShapeProperties1.Append(applicationNonVisualDrawingProperties1);
    
                ShapeProperties shapeProperties1 = new ShapeProperties(){ BlackWhiteMode = A.BlackWhiteModeValues.Auto };
    
                A.Transform2D transform2D1 = new A.Transform2D();
                A.Offset offset1 = new A.Offset(){ X = 2209463L, Y = 2213113L };
                A.Extents extents1 = new A.Extents(){ Cx = 2510295L, Cy = 383497L };
    
                transform2D1.Append(offset1);
                transform2D1.Append(extents1);
    
                A.PresetGeometry presetGeometry1 = new A.PresetGeometry(){ Preset = A.ShapeTypeValues.Rectangle };
                A.AdjustValueList adjustValueList1 = new A.AdjustValueList();
    
                presetGeometry1.Append(adjustValueList1);
                A.NoFill noFill1 = new A.NoFill();
    
                A.Outline outline1 = new A.Outline(){ Width = 12700, CapType = A.LineCapValues.Flat };
    
                A.SolidFill solidFill1 = new A.SolidFill();
                A.RgbColorModelHex rgbColorModelHex1 = new A.RgbColorModelHex(){ Val = "FF0000" };
    
                solidFill1.Append(rgbColorModelHex1);
                A.Miter miter1 = new A.Miter(){ Limit = 800000 };
                A.HeadEnd headEnd1 = new A.HeadEnd(){ Type = A.LineEndValues.None, Width = A.LineEndWidthValues.Medium, Length = A.LineEndLengthValues.Medium };
                A.TailEnd tailEnd1 = new A.TailEnd(){ Type = A.LineEndValues.None, Width = A.LineEndWidthValues.Medium, Length = A.LineEndLengthValues.Medium };
    
                outline1.Append(solidFill1);
                outline1.Append(miter1);
                outline1.Append(headEnd1);
                outline1.Append(tailEnd1);
                A.EffectList effectList1 = new A.EffectList();
    
                A.ShapePropertiesExtensionList shapePropertiesExtensionList1 = new A.ShapePropertiesExtensionList();
    
                A.ShapePropertiesExtension shapePropertiesExtension1 = new A.ShapePropertiesExtension(){ Uri = "{909E8E84-426E-40DD-AFC4-6F175D3DCCD1}" };
    
                A14.HiddenFillProperties hiddenFillProperties1 = new A14.HiddenFillProperties();
                hiddenFillProperties1.AddNamespaceDeclaration("a14", "http://schemas.microsoft.com/office/drawing/2010/main");
    
                A.SolidFill solidFill2 = new A.SolidFill();
                A.RgbColorModelHex rgbColorModelHex2 = new A.RgbColorModelHex(){ Val = "FFFFFF" };
    
                solidFill2.Append(rgbColorModelHex2);
    
                hiddenFillProperties1.Append(solidFill2);
    
                shapePropertiesExtension1.Append(hiddenFillProperties1);
    
                shapePropertiesExtensionList1.Append(shapePropertiesExtension1);
    
                shapeProperties1.Append(transform2D1);
                shapeProperties1.Append(presetGeometry1);
                shapeProperties1.Append(noFill1);
                shapeProperties1.Append(outline1);
                shapeProperties1.Append(effectList1);
                shapeProperties1.Append(shapePropertiesExtensionList1);
    
                TextBody textBody1 = new TextBody();
                A.BodyProperties bodyProperties1 = new A.BodyProperties(){ LeftInset = 0, TopInset = 0, RightInset = 0, BottomInset = 0 };
                A.ListStyle listStyle1 = new A.ListStyle();
    
                A.Paragraph paragraph1 = new A.Paragraph();
    
                A.ParagraphProperties paragraphProperties1 = new A.ParagraphProperties();
                A.DefaultRunProperties defaultRunProperties1 = new A.DefaultRunProperties();
    
                paragraphProperties1.Append(defaultRunProperties1);
    
                A.Run run1 = new A.Run();
    
                A.RunProperties runProperties1 = new A.RunProperties(){ Language = "en-US", FontSize = 1800, Bold = true, Dirty = false };
                A.LatinFont latinFont1 = new A.LatinFont(){ Typeface = "Helvetica Neue" };
                A.EastAsianFont eastAsianFont1 = new A.EastAsianFont(){ Typeface = "MS Pゴシック", CharacterSet = 0 };
                A.ComplexScriptFont complexScriptFont1 = new A.ComplexScriptFont(){ Typeface = "Helvetica Neue" };
                A.SymbolFont symbolFont1 = new A.SymbolFont(){ Typeface = "Calibri", CharacterSet = 0 };
    
                runProperties1.Append(latinFont1);
                runProperties1.Append(eastAsianFont1);
                runProperties1.Append(complexScriptFont1);
                runProperties1.Append(symbolFont1);
                A.Text text1 = new A.Text();
                text1.Text = "ERP";
    
                run1.Append(runProperties1);
                run1.Append(text1);
    
                paragraph1.Append(paragraphProperties1);
                paragraph1.Append(run1);
    
                A.Paragraph paragraph2 = new A.Paragraph();
    
                A.ParagraphProperties paragraphProperties2 = new A.ParagraphProperties();
                A.DefaultRunProperties defaultRunProperties2 = new A.DefaultRunProperties();
    
                paragraphProperties2.Append(defaultRunProperties2);
    
                A.EndParagraphRunProperties endParagraphRunProperties1 = new A.EndParagraphRunProperties(){ Language = "en-US", FontSize = 1800, Bold = true, Dirty = false };
                A.LatinFont latinFont2 = new A.LatinFont(){ Typeface = "Helvetica Neue" };
                A.EastAsianFont eastAsianFont2 = new A.EastAsianFont(){ Typeface = "MS Pゴシック", CharacterSet = 0 };
                A.ComplexScriptFont complexScriptFont2 = new A.ComplexScriptFont(){ Typeface = "Helvetica Neue" };
                A.SymbolFont symbolFont2 = new A.SymbolFont(){ Typeface = "Calibri", CharacterSet = 0 };
    
                endParagraphRunProperties1.Append(latinFont2);
                endParagraphRunProperties1.Append(eastAsianFont2);
                endParagraphRunProperties1.Append(complexScriptFont2);
                endParagraphRunProperties1.Append(symbolFont2);
    
                paragraph2.Append(paragraphProperties2);
                paragraph2.Append(endParagraphRunProperties1);
    
                textBody1.Append(bodyProperties1);
                textBody1.Append(listStyle1);
                textBody1.Append(paragraph1);
                textBody1.Append(paragraph2);
    
                shape1.Append(nonVisualShapeProperties1);
                shape1.Append(shapeProperties1);
                shape1.Append(textBody1);
                return shape1;
            }
    
    
        }
    }
    

    The code uses the SlideMaster's OtherStyle as the base style for items that aren't placeholders, but this seems to indicate black, left justified text instead of the white centered text that shows in PowerPoint.

    The OtherStyle reflected code is below. Note that Text1 is black in the color scheme map.

    using DocumentFormat.OpenXml.Presentation;
    using A = DocumentFormat.OpenXml.Drawing;
    using DocumentFormat.OpenXml;
    
    namespace GeneratedCode
    {
        public class GeneratedClass
        {
            // Creates an OtherStyle instance and adds its children.
            public OtherStyle GenerateOtherStyle()
            {
                OtherStyle otherStyle1 = new OtherStyle();
    
                A.DefaultParagraphProperties defaultParagraphProperties1 = new A.DefaultParagraphProperties();
                A.DefaultRunProperties defaultRunProperties1 = new A.DefaultRunProperties(){ Language = "en-US" };
    
                defaultParagraphProperties1.Append(defaultRunProperties1);
    
                A.Level1ParagraphProperties level1ParagraphProperties1 = new A.Level1ParagraphProperties(){ LeftMargin = 0, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 171450, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true };
    
                A.DefaultRunProperties defaultRunProperties2 = new A.DefaultRunProperties(){ FontSize = 700, Kerning = 1200 };
    
                A.SolidFill solidFill1 = new A.SolidFill();
                A.SchemeColor schemeColor1 = new A.SchemeColor(){ Val = A.SchemeColorValues.Text1 };
    
                solidFill1.Append(schemeColor1);
                A.LatinFont latinFont1 = new A.LatinFont(){ Typeface = "+mn-lt" };
                A.EastAsianFont eastAsianFont1 = new A.EastAsianFont(){ Typeface = "+mn-ea" };
                A.ComplexScriptFont complexScriptFont1 = new A.ComplexScriptFont(){ Typeface = "+mn-cs" };
    
                defaultRunProperties2.Append(solidFill1);
                defaultRunProperties2.Append(latinFont1);
                defaultRunProperties2.Append(eastAsianFont1);
                defaultRunProperties2.Append(complexScriptFont1);
    
                level1ParagraphProperties1.Append(defaultRunProperties2);
    
                A.Level2ParagraphProperties level2ParagraphProperties1 = new A.Level2ParagraphProperties(){ LeftMargin = 171450, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 171450, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true };
    
                A.DefaultRunProperties defaultRunProperties3 = new A.DefaultRunProperties(){ FontSize = 700, Kerning = 1200 };
    
                A.SolidFill solidFill2 = new A.SolidFill();
                A.SchemeColor schemeColor2 = new A.SchemeColor(){ Val = A.SchemeColorValues.Text1 };
    
                solidFill2.Append(schemeColor2);
                A.LatinFont latinFont2 = new A.LatinFont(){ Typeface = "+mn-lt" };
                A.EastAsianFont eastAsianFont2 = new A.EastAsianFont(){ Typeface = "+mn-ea" };
                A.ComplexScriptFont complexScriptFont2 = new A.ComplexScriptFont(){ Typeface = "+mn-cs" };
    
                defaultRunProperties3.Append(solidFill2);
                defaultRunProperties3.Append(latinFont2);
                defaultRunProperties3.Append(eastAsianFont2);
                defaultRunProperties3.Append(complexScriptFont2);
    
                level2ParagraphProperties1.Append(defaultRunProperties3);
    
                A.Level3ParagraphProperties level3ParagraphProperties1 = new A.Level3ParagraphProperties(){ LeftMargin = 342900, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 171450, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true };
    
                A.DefaultRunProperties defaultRunProperties4 = new A.DefaultRunProperties(){ FontSize = 700, Kerning = 1200 };
    
                A.SolidFill solidFill3 = new A.SolidFill();
                A.SchemeColor schemeColor3 = new A.SchemeColor(){ Val = A.SchemeColorValues.Text1 };
    
                solidFill3.Append(schemeColor3);
                A.LatinFont latinFont3 = new A.LatinFont(){ Typeface = "+mn-lt" };
                A.EastAsianFont eastAsianFont3 = new A.EastAsianFont(){ Typeface = "+mn-ea" };
                A.ComplexScriptFont complexScriptFont3 = new A.ComplexScriptFont(){ Typeface = "+mn-cs" };
    
                defaultRunProperties4.Append(solidFill3);
                defaultRunProperties4.Append(latinFont3);
                defaultRunProperties4.Append(eastAsianFont3);
                defaultRunProperties4.Append(complexScriptFont3);
    
                level3ParagraphProperties1.Append(defaultRunProperties4);
    
                A.Level4ParagraphProperties level4ParagraphProperties1 = new A.Level4ParagraphProperties(){ LeftMargin = 514350, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 171450, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true };
    
                A.DefaultRunProperties defaultRunProperties5 = new A.DefaultRunProperties(){ FontSize = 700, Kerning = 1200 };
    
                A.SolidFill solidFill4 = new A.SolidFill();
                A.SchemeColor schemeColor4 = new A.SchemeColor(){ Val = A.SchemeColorValues.Text1 };
    
                solidFill4.Append(schemeColor4);
                A.LatinFont latinFont4 = new A.LatinFont(){ Typeface = "+mn-lt" };
                A.EastAsianFont eastAsianFont4 = new A.EastAsianFont(){ Typeface = "+mn-ea" };
                A.ComplexScriptFont complexScriptFont4 = new A.ComplexScriptFont(){ Typeface = "+mn-cs" };
    
                defaultRunProperties5.Append(solidFill4);
                defaultRunProperties5.Append(latinFont4);
                defaultRunProperties5.Append(eastAsianFont4);
                defaultRunProperties5.Append(complexScriptFont4);
    
                level4ParagraphProperties1.Append(defaultRunProperties5);
    
                A.Level5ParagraphProperties level5ParagraphProperties1 = new A.Level5ParagraphProperties(){ LeftMargin = 685800, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 171450, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true };
    
                A.DefaultRunProperties defaultRunProperties6 = new A.DefaultRunProperties(){ FontSize = 700, Kerning = 1200 };
    
                A.SolidFill solidFill5 = new A.SolidFill();
                A.SchemeColor schemeColor5 = new A.SchemeColor(){ Val = A.SchemeColorValues.Text1 };
    
                solidFill5.Append(schemeColor5);
                A.LatinFont latinFont5 = new A.LatinFont(){ Typeface = "+mn-lt" };
                A.EastAsianFont eastAsianFont5 = new A.EastAsianFont(){ Typeface = "+mn-ea" };
                A.ComplexScriptFont complexScriptFont5 = new A.ComplexScriptFont(){ Typeface = "+mn-cs" };
    
                defaultRunProperties6.Append(solidFill5);
                defaultRunProperties6.Append(latinFont5);
                defaultRunProperties6.Append(eastAsianFont5);
                defaultRunProperties6.Append(complexScriptFont5);
    
                level5ParagraphProperties1.Append(defaultRunProperties6);
    
                A.Level6ParagraphProperties level6ParagraphProperties1 = new A.Level6ParagraphProperties(){ LeftMargin = 857250, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 171450, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true };
    
                A.DefaultRunProperties defaultRunProperties7 = new A.DefaultRunProperties(){ FontSize = 700, Kerning = 1200 };
    
                A.SolidFill solidFill6 = new A.SolidFill();
                A.SchemeColor schemeColor6 = new A.SchemeColor(){ Val = A.SchemeColorValues.Text1 };
    
                solidFill6.Append(schemeColor6);
                A.LatinFont latinFont6 = new A.LatinFont(){ Typeface = "+mn-lt" };
                A.EastAsianFont eastAsianFont6 = new A.EastAsianFont(){ Typeface = "+mn-ea" };
                A.ComplexScriptFont complexScriptFont6 = new A.ComplexScriptFont(){ Typeface = "+mn-cs" };
    
                defaultRunProperties7.Append(solidFill6);
                defaultRunProperties7.Append(latinFont6);
                defaultRunProperties7.Append(eastAsianFont6);
                defaultRunProperties7.Append(complexScriptFont6);
    
                level6ParagraphProperties1.Append(defaultRunProperties7);
    
                A.Level7ParagraphProperties level7ParagraphProperties1 = new A.Level7ParagraphProperties(){ LeftMargin = 1028700, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 171450, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true };
    
                A.DefaultRunProperties defaultRunProperties8 = new A.DefaultRunProperties(){ FontSize = 700, Kerning = 1200 };
    
                A.SolidFill solidFill7 = new A.SolidFill();
                A.SchemeColor schemeColor7 = new A.SchemeColor(){ Val = A.SchemeColorValues.Text1 };
    
                solidFill7.Append(schemeColor7);
                A.LatinFont latinFont7 = new A.LatinFont(){ Typeface = "+mn-lt" };
                A.EastAsianFont eastAsianFont7 = new A.EastAsianFont(){ Typeface = "+mn-ea" };
                A.ComplexScriptFont complexScriptFont7 = new A.ComplexScriptFont(){ Typeface = "+mn-cs" };
    
                defaultRunProperties8.Append(solidFill7);
                defaultRunProperties8.Append(latinFont7);
                defaultRunProperties8.Append(eastAsianFont7);
                defaultRunProperties8.Append(complexScriptFont7);
    
                level7ParagraphProperties1.Append(defaultRunProperties8);
    
                A.Level8ParagraphProperties level8ParagraphProperties1 = new A.Level8ParagraphProperties(){ LeftMargin = 1200150, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 171450, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true };
    
                A.DefaultRunProperties defaultRunProperties9 = new A.DefaultRunProperties(){ FontSize = 700, Kerning = 1200 };
    
                A.SolidFill solidFill8 = new A.SolidFill();
                A.SchemeColor schemeColor8 = new A.SchemeColor(){ Val = A.SchemeColorValues.Text1 };
    
                solidFill8.Append(schemeColor8);
                A.LatinFont latinFont8 = new A.LatinFont(){ Typeface = "+mn-lt" };
                A.EastAsianFont eastAsianFont8 = new A.EastAsianFont(){ Typeface = "+mn-ea" };
                A.ComplexScriptFont complexScriptFont8 = new A.ComplexScriptFont(){ Typeface = "+mn-cs" };
    
                defaultRunProperties9.Append(solidFill8);
                defaultRunProperties9.Append(latinFont8);
                defaultRunProperties9.Append(eastAsianFont8);
                defaultRunProperties9.Append(complexScriptFont8);
    
                level8ParagraphProperties1.Append(defaultRunProperties9);
    
                A.Level9ParagraphProperties level9ParagraphProperties1 = new A.Level9ParagraphProperties(){ LeftMargin = 1371600, Alignment = A.TextAlignmentTypeValues.Left, DefaultTabSize = 171450, RightToLeft = false, EastAsianLineBreak = true, LatinLineBreak = false, Height = true };
    
                A.DefaultRunProperties defaultRunProperties10 = new A.DefaultRunProperties(){ FontSize = 700, Kerning = 1200 };
    
                A.SolidFill solidFill9 = new A.SolidFill();
                A.SchemeColor schemeColor9 = new A.SchemeColor(){ Val = A.SchemeColorValues.Text1 };
    
                solidFill9.Append(schemeColor9);
                A.LatinFont latinFont9 = new A.LatinFont(){ Typeface = "+mn-lt" };
                A.EastAsianFont eastAsianFont9 = new A.EastAsianFont(){ Typeface = "+mn-ea" };
                A.ComplexScriptFont complexScriptFont9 = new A.ComplexScriptFont(){ Typeface = "+mn-cs" };
    
                defaultRunProperties10.Append(solidFill9);
                defaultRunProperties10.Append(latinFont9);
                defaultRunProperties10.Append(eastAsianFont9);
                defaultRunProperties10.Append(complexScriptFont9);
    
                level9ParagraphProperties1.Append(defaultRunProperties10);
    
                otherStyle1.Append(defaultParagraphProperties1);
                otherStyle1.Append(level1ParagraphProperties1);
                otherStyle1.Append(level2ParagraphProperties1);
                otherStyle1.Append(level3ParagraphProperties1);
                otherStyle1.Append(level4ParagraphProperties1);
                otherStyle1.Append(level5ParagraphProperties1);
                otherStyle1.Append(level6ParagraphProperties1);
                otherStyle1.Append(level7ParagraphProperties1);
                otherStyle1.Append(level8ParagraphProperties1);
                otherStyle1.Append(level9ParagraphProperties1);
                return otherStyle1;
            }
    
    
        }
    }
    

    Tuesday, October 22, 2013 8:12 PM

Answers

  • Another found:

    <a:lvl1pPr algn="ctr" rtl="0" fontAlgn="base" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
      <a:spcBef>
        <a:spcPct val="0" />
      </a:spcBef>
      <a:spcAft>
        <a:spcPct val="0" />
      </a:spcAft>
      <a:defRPr sz="2100" kern="1200">
        <a:solidFill>
          <a:srgbClr val="FFFFFF" />
        </a:solidFill>
        <a:latin typeface="Gill Sans" charset="0" />
        <a:ea typeface="ヒラギノ角ゴ ProN W3" charset="0" />
        <a:cs typeface="ヒラギノ角ゴ ProN W3" charset="0" />
        <a:sym typeface="Gill Sans" charset="0" />
      </a:defRPr>
    </a:lvl1pPr>

    This is a DefaultRunProperties. This element is under p:presentation/p:defaultTextStyle.

    There are ten elements:

    DefaultParagraphProperties, level1ParagraphProperties,... level9ParagraphProperties.

    refer to http://msdn.microsoft.com/en-us/libRary/documentformat.openxml.drawing.level1paragraphproperties

    If using this style, text color will be white since the color value is "FFFFFF" and text is centered since algn="ctr".

    But I haven't found what's the correlation between these elements.

    Maybe this forum is more suitable to find the answer:

    Office Open XML File Format Implementation

    • Edited by Andy_mic Friday, October 25, 2013 8:24 AM
    • Marked as answer by scotchfaster Tuesday, October 29, 2013 6:37 PM
    Friday, October 25, 2013 8:22 AM

All replies

  • >>I am working on a tool<<

    What's the tool? 

    >>but failing on some PowerPoint files created with older versions<<

    What's the old version of PowerPoint?

    Wednesday, October 23, 2013 5:39 PM
  • Thanks for the reply.

    The tool is an in-house conversion service, written in C# and .NET, which I have inherited from a previous developer.

    I'm not sure what the version of PowerPoint was that was used to create this file, as it was just given to me as one of several problematic presentations. My experience is that there is a difference between the format of elements that created by older formats of PowerPoint and newer versions, even on the same slide and after saving in the latest version of PowerPoint. For example, if I create a new shape on the same slide, it will have a ShapeStyle, but the older element still will not.

    My question is really all about understanding the rules that PowerPoint uses to determine the text formatting on a shape that has no ShapeStyle and is not derived from a placeholder (that is, an element that doesn't have a NonVisualShapeProperties.ApplicationNonVisualDrawingProperties.PlaceholderShape).

    In this file, the only reference to A.TextAlignmentTypeValues.Center that I can find is in the SlideMaster.TextStyles.TitleStyle. So how is PowerPoint determining that this text is centered? Is it using the Title style, and if so, why? If not, why is the text centered?

    For what it's worth, OpenOffice displays the text in this presentation just as our tool imports it: black and left-justified, instead of the white and centered text in PowerPoint. We would ideally like to do better.

    Thanks again!

    Wednesday, October 23, 2013 9:42 PM
  • Would you mind sharing the PowerPoint file for us through SkyDrive?
    Thursday, October 24, 2013 1:46 AM
  • Here's the link:

    CEP.PPTX

    Thursday, October 24, 2013 4:59 AM
  • There is a special element in the existing shape:

    <a:defRPr />

    The style is set by this class: DocumentFormat.OpenXml.Drawing.DefaultRunProperties.

    refer to:

    http://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.defaultrunproperties_members.ASPX

    http://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.defaultrunproperties(v=office.14).aspx

    Thursday, October 24, 2013 6:54 AM
  • That's an intriguing answer, but I still don't get it. The documentation has this to say about the DefaultRunProperties element:

    This element contains all default run level text properties for the text runs within a containing paragraph. These properties are to be used when overriding properties have not been defined within the rPr element.

    If a Paragraph contains a DefaultRunProperties, I suppose that becomes the source of default styles when the run doesn't specify a given style. But then, what if the DefaultRunProperties itself doesn't specify a style? I see in the documentation this comment about bold:

    If this attribute is omitted, than a value of 0, or false is assumed.

    That makes sense, but:

    1) Where is text color specified? I don't see a property in DefaultRunProperties to specify the font color or FontReference. I'm not sure how we get to white text color from this data. Is there some logic which defaults to white when some data isn't specified?

    2) How is this text determined to be centered?

    Thanks for helping me get to the bottom of this.

    Thursday, October 24, 2013 9:09 PM
  • Another found:

    <a:lvl1pPr algn="ctr" rtl="0" fontAlgn="base" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
      <a:spcBef>
        <a:spcPct val="0" />
      </a:spcBef>
      <a:spcAft>
        <a:spcPct val="0" />
      </a:spcAft>
      <a:defRPr sz="2100" kern="1200">
        <a:solidFill>
          <a:srgbClr val="FFFFFF" />
        </a:solidFill>
        <a:latin typeface="Gill Sans" charset="0" />
        <a:ea typeface="ヒラギノ角ゴ ProN W3" charset="0" />
        <a:cs typeface="ヒラギノ角ゴ ProN W3" charset="0" />
        <a:sym typeface="Gill Sans" charset="0" />
      </a:defRPr>
    </a:lvl1pPr>

    This is a DefaultRunProperties. This element is under p:presentation/p:defaultTextStyle.

    There are ten elements:

    DefaultParagraphProperties, level1ParagraphProperties,... level9ParagraphProperties.

    refer to http://msdn.microsoft.com/en-us/libRary/documentformat.openxml.drawing.level1paragraphproperties

    If using this style, text color will be white since the color value is "FFFFFF" and text is centered since algn="ctr".

    But I haven't found what's the correlation between these elements.

    Maybe this forum is more suitable to find the answer:

    Office Open XML File Format Implementation

    • Edited by Andy_mic Friday, October 25, 2013 8:24 AM
    • Marked as answer by scotchfaster Tuesday, October 29, 2013 6:37 PM
    Friday, October 25, 2013 8:22 AM
  • <<1) Where is text color specified?>>

    The default fonts and colors should be coming from the THEME attached to the Office document.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, October 25, 2013 1:54 PM
    Moderator
  • That looks promising. I'm not quite sure how to reconcile Presentation.DefaultTextStyle with the slide's SlideMaster.TextStyles.OtherStyle. The documentation has this to say about that class:

    This element specifies the default text styles that are to be used within the presentation. The text style defined here can be referenced when inserting a new slide if that slide is not associated with a master slide or if no styling information has been otherwise specified for the text within the presentation slide.

    Perhaps the rule is that if the Shape does not have a ShapeStyle, it will use the DefaultTextStyle from the Presentation. I'm going to investigate that and will mark this as the answer if that proves to be correct.

    Using that rule does seem to fix the import of this presentation, but more testing will be required to ensure it doesn't break anything else.


    Friday, October 25, 2013 3:11 PM
  • << The default fonts and colors should be coming from the THEME attached to the Office document. >>

    In this case, though, it's not. If I create a new shape on the slide and then change the theme colors, the color of the text on the new shape will change, but not on the existing shape. So this shape is getting its font formatting from elsewhere - perhaps the DefaultTextStyle in the Presentation as Andy was suggesting?



    Friday, October 25, 2013 3:14 PM