11

Does anyone know how character styles are inherited in a pptx file? I know that it goes at least like this:

  1. Local Run props (a:rPr)
  2. Local Paragraph props (a:pPr/a:defRPr)
  3. Shape Paragraph props (a:lstStyle/a:lvlXpPr/a:defRPr)
  4. Paragraph props from Layout?
  5. Master Slide Paragraph props (p:txStyles/(p:titleStyle|p:bodyStyle|p:otherStyle)/a:lvlXpPr/a:defRPr)
  6. Slide Theme (a:objectDefaults/(a:spDef|a:lnDef|a:txDef)/a:lstStyle/a:lvlXpPr/a:defRPr)
  7. Presentation Defaults (p:defaultTextStyle/a:lvlXpPr/a:defRPr)

But, when I compare it to the results of other applications, it doesn't match. Due to technical reasons, I can't use a library that already does this for me, I am reading the xml myself. The apache POI source has some TODO: markings in the relevant areas, and I am having trouble understanding the LibreOffice code.

Edit: To explain further, I want to find the absolute run properties, not the relative run properties. On could think of it like this: you have several transparencies for an overhead projector. I want to see the image created from all of the pages, not just the local one.

BrainStorm.exe
  • 1,565
  • 3
  • 23
  • 40
  • what are you trying to do? you want to change some styles programmatically? – Krishna Chaithanya Muthyala May 09 '16 at 16:49
  • The most local styles yes, but I need to know what the parents define so I won't be redundant. – BrainStorm.exe May 09 '16 at 16:57
  • I think you should be looking at the theme part and how to reference it wherever you need...did you try checking theme part? If you can give us an example of what exactly you want to do, it will help understand the problem better and try out different things. – Krishna Chaithanya Muthyala May 10 '16 at 09:18
  • Yes, I have tried checking the theme part, it is number 6 in the list. – BrainStorm.exe May 10 '16 at 14:57
  • It's complex. Go in this order: 1, 2, 3, 7, 6, 5. It's not so much inheritance, as it is look up. Meaning that when it's set, it's set. For example if font size is not in 1 2, 3, and it is in 7, then 6 won't change it, even if it is set there. But there's more to this subject. – Todd Main Nov 05 '19 at 01:35

1 Answers1

0

I suppose that by writing inheritance in this context You mean that one style is based on another. It seems that You can use BasedOn property to verify this programatically.

I've found an article about this with a sample code automatically detect the style hierarchy in a selected document. You can find it here: https://blogs.msdn.microsoft.com/ericwhite/2010/03/29/testing-for-base-styles-in-open-xml-wordprocessingml-documents/. The code it written for Word (DOCX) files, but I suppose it should be very similar for PowerPoint (PPTX). If You have any troubles using the code for PPTX file, let me know and I'll try to help.

According to this information https://msdn.microsoft.com/en-us/library/office/gg188064.aspx#sectionSection5, "character styles" can be referenced only by run elements type and cannot be referenced by paragraphs.

You can also find an article about styles inheritance here: https://blogs.msdn.microsoft.com/ericwhite/2009/10/28/open-xml-wordprocessingml-style-inheritance-post-4/

While it does not provide an answer to Your question directly, it contains some additional information associated with styles inheritance, so may appear useful for You.

Lukasz M
  • 5,635
  • 2
  • 22
  • 29