Skip to content

Default bullets and Reader 2007 #744

Open
@websuasive

Description

@websuasive

I'm trying to use the PHPPresentation Reader to process a plethora of Powerpoint 2007 presentations and have noticed that it doesn't appear to correctly attribute bullets...

If you look at the following XML, there are two columns on a simple page (image attached below so you can see what it looks like).

The first column has a list of text and the second is a list of bullets. Yet reader returns two lists of text because it makes the assumption that any paragraph has the bullet type of TYPE_NONE.

But looking at the XML, it shows that the text without bullets is explicitly defined as '<a:buNone/>'. Where as the text that is a bullet has nothing marking it as such....

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<p:sld
	xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
	xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
	xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
	<p:cSld>
		<p:spTree>
			<p:nvGrpSpPr>
				<p:cNvPr id="1" name=""/>
				<p:cNvGrpSpPr/>
				<p:nvPr/>
			</p:nvGrpSpPr>
			<p:grpSpPr>
				<a:xfrm>
					<a:off x="0" y="0"/>
					<a:ext cx="0" cy="0"/>
					<a:chOff x="0" y="0"/>
					<a:chExt cx="0" cy="0"/>
				</a:xfrm>
			</p:grpSpPr>
			<p:sp>
				<p:nvSpPr>
					<p:cNvPr id="4" name="Title 3">
						<a:extLst>
							<a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}">
								<a16:creationId
									xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{4154ABC1-8083-864D-9598-F2E0D26D4A7C}"/>
								</a:ext>
							</a:extLst>
						</p:cNvPr>
						<p:cNvSpPr>
							<a:spLocks noGrp="1"/>
						</p:cNvSpPr>
						<p:nvPr>
							<p:ph type="title"/>
						</p:nvPr>
					</p:nvSpPr>
					<p:spPr/>
					<p:txBody>
						<a:bodyPr/>
						<a:lstStyle/>
						<a:p>
							<a:r>
								<a:rPr lang="en-GB" dirty="0"/>
								<a:t>Two column Layout</a:t>
							</a:r>
						</a:p>
					</p:txBody>
				</p:sp>
				<p:sp>
					<p:nvSpPr>
						<p:cNvPr id="5" name="Content Placeholder 4">
							<a:extLst>
								<a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}">
									<a16:creationId
										xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{9BC97CCF-A80E-184C-861B-A575A0580FB9}"/>
									</a:ext>
								</a:extLst>
							</p:cNvPr>
							<p:cNvSpPr>
								<a:spLocks noGrp="1"/>
							</p:cNvSpPr>
							<p:nvPr>
								<p:ph sz="half" idx="1"/>
							</p:nvPr>
						</p:nvSpPr>
						<p:spPr/>
						<p:txBody>
							<a:bodyPr/>
							<a:lstStyle/>
							<a:p>
								<a:pPr marL="0" indent="0">
									<a:buNone/>
								</a:pPr>
								<a:r>
									<a:rPr lang="en-GB" dirty="0"/>
									<a:t>Column 1, no bullets.  Just a paragraph of text to see how the run works.</a:t>
								</a:r>
							</a:p>
							<a:p>
								<a:pPr marL="0" indent="0">
									<a:buNone/>
								</a:pPr>
								<a:endParaRPr lang="en-GB" dirty="0"/>
							</a:p>
							<a:p>
								<a:pPr marL="0" indent="0">
									<a:buNone/>
								</a:pPr>
								<a:r>
									<a:rPr lang="en-GB" dirty="0"/>
									<a:t>Then a second set of text in the same column.</a:t>
								</a:r>
							</a:p>
						</p:txBody>
					</p:sp>
					<p:sp>
						<p:nvSpPr>
							<p:cNvPr id="6" name="Content Placeholder 5">
								<a:extLst>
									<a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}">
										<a16:creationId
											xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{032AECFE-1B86-4046-9508-5445E2BAE371}"/>
										</a:ext>
									</a:extLst>
								</p:cNvPr>
								<p:cNvSpPr>
									<a:spLocks noGrp="1"/>
								</p:cNvSpPr>
								<p:nvPr>
									<p:ph sz="half" idx="2"/>
								</p:nvPr>
							</p:nvSpPr>
							<p:spPr/>
							<p:txBody>
								<a:bodyPr/>
								<a:lstStyle/>
								<a:p>
									<a:r>
										<a:rPr lang="en-GB" dirty="0"/>
										<a:t>Some bullets in the second col</a:t>
									</a:r>
								</a:p>
								<a:p>
									<a:r>
										<a:rPr lang="en-GB" dirty="0"/>
										<a:t>More bullets</a:t>
									</a:r>
								</a:p>
								<a:p>
									<a:r>
										<a:rPr lang="en-GB" dirty="0"/>
										<a:t>And a third set with two</a:t>
									</a:r>
								</a:p>
								<a:p>
									<a:pPr lvl="1"/>
									<a:r>
										<a:rPr lang="en-GB" dirty="0"/>
										<a:t>Children (1)</a:t>
									</a:r>
								</a:p>
								<a:p>
									<a:pPr lvl="1"/>
									<a:r>
										<a:rPr lang="en-GB" dirty="0"/>
										<a:t>Children (2)</a:t>
									</a:r>
								</a:p>
							</p:txBody>
						</p:sp>
					</p:spTree>
					<p:extLst>
						<p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}">
							<p14:creationId
								xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="2235500343"/>
							</p:ext>
						</p:extLst>
					</p:cSld>
					<p:clrMapOvr>
						<a:masterClrMapping/>
					</p:clrMapOvr>
				</p:sld>
image

Is anyone who knows the spec able to please comment on this - as it's not as simple as defaulting to TYPE_BULLET in the loadParagraph function in PowerPoint2007.php though that seems to improve the situation.

ie, quickly experimenting with the code by adding in a $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET); rather than a TYPE_NONE and then setting it explicitly to NONE if a a:buNone is detected:

...

 $oElementSpacingAfter = $document->getElement('a:spcAft/a:spcPts', $oSubElement);
            if ($oElementSpacingAfter instanceof DOMElement) {
                $oParagraph->setSpacingAfter($oElementSpacingAfter->getAttribute('val') / 100);
            }

            $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET);

            $oElementBuFont = $document->getElement('a:buNone', $oSubElement);
            if ($oElementBuFont instanceof DOMElement) {
                $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_NONE);
            }

            $oElementBuFont = $document->getElement('a:buFont', $oSubElement);
            if ($oElementBuFont instanceof DOMElement) {
                if ($oElementBuFont->hasAttribute('typeface')) {
                    $oParagraph->getBulletStyle()->setBulletFont($oElementBuFont->getAttribute('typeface'));
                }
            }
            $oElementBuChar = $document->getElement('a:buChar', $oSubElement);
            if ($oElementBuChar instanceof DOMElement) {
                $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET);
                if ($oElementBuChar->hasAttribute('char')) {
                    $oParagraph->getBulletStyle()->setBulletChar($oElementBuChar->getAttribute('char'));
                }
            }

...

Thank you,
Mark

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions