Coder Social home page Coder Social logo

Comments (11)

Progi1984 avatar Progi1984 commented on May 21, 2024

@dung1764 At the moment, no. But any PR are welcome :)

OpenXML :

Fichier .rels

<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide" Target="../notesSlides/notesSlide1.xml"/>

notesSlides1.xml

<!-- top -->
<p:notes xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">

<p:sp>
    <p:nvSpPr>
        <p:cNvPr id="45" name="PlaceHolder 1"/>
            <p:nvPr>
                <p:ph type="body"/>
            </p:nvPr>

OpenDocument :

<office:presentation>
    <draw:page draw:name="page0" draw:style-name="dp1" draw:master-page-name="Standard" presentation:presentation-page-layout-name="AL1T0">
        <draw:frame draw:style-name="gr1" draw:layer="layout" svg:width="15.875cm" svg:height="7.997cm" svg:x="4.498cm" svg:y="4.763cm">
            <draw:text-box>
                <text:p text:style-name="P1">
                    <text:span text:style-name="T1">Thank you for using PHPPowerPoint!</text:span>
                </text:p>
            </draw:text-box>
        </draw:frame>
        <presentation:notes draw:style-name="dp2">
            <draw:page-thumbnail draw:style-name="gr2" draw:layer="layout" svg:width="14.848cm" svg:height="11.136cm" svg:x="3.075cm" svg:y="2.257cm" draw:page-number="1" presentation:class="page"/>
            <draw:frame presentation:style-name="pr1" draw:layer="layout" svg:width="16.799cm" svg:height="13.364cm" svg:x="2.1cm" svg:y="14.107cm" presentation:class="notes">
                <draw:text-box>
                    <text:p>Test</text:p>
                    <text:p/>
                    <text:p/>
                    <text:p>Test2</text:p>
                    <text:p/>
                    <text:p/>
                    <text:p>Test3</text:p>
                    <text:p/>
                    <text:p/>
                    <text:p>OpenDocument rocks</text:p>
                </draw:text-box>
            </draw:frame>
        </presentation:notes>
    </draw:page>
    <presentation:settings presentation:mouse-visible="false"/>
</office:presentation>

from phppresentation.

Progi1984 avatar Progi1984 commented on May 21, 2024

@dung1764 Support for notes slide implemented in ODPresentation & PowerPoint2007 Writer. Could you test and give me a feedback ? A sample has been added.

from phppresentation.

Progi1984 avatar Progi1984 commented on May 21, 2024

@dung1764 It's ok for you ?

from phppresentation.

JewrassicPark avatar JewrassicPark commented on May 21, 2024

I can see the xml in the archive but the notes don't seem to show up in ppt (Testing with ppt 2013)

from phppresentation.

JewrassicPark avatar JewrassicPark commented on May 21, 2024

I changed the writeNote function of my Slide writer for Powerpoint2007 and this works for me:

    public function writeNote(Note $pNote = null)
    {
        // Check slide
        if (is_null($pNote)) {
            throw new \Exception("Invalid \PhpOffice\PhpPowerpoint\Slide\Note object passed.");
        }

        // Create XML writer
        $objWriter = $this->getXMLWriter();

        // XML header
        $objWriter->startDocument('1.0', 'UTF-8', 'yes');

        // p:notes
        $objWriter->startElement('p:notes');
        $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
        $objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main');
        $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');

        // p:cSld
        $objWriter->startElement('p:cSld');

        // p:spTree
        $objWriter->startElement('p:spTree');

        // p:nvGrpSpPr
        $objWriter->startElement('p:nvGrpSpPr');

        // p:cNvPr
        $objWriter->startElement('p:cNvPr');
        $objWriter->writeAttribute('id', '1');
        $objWriter->writeAttribute('name', '');
        $objWriter->endElement();

        // p:cNvGrpSpPr
        $objWriter->writeElement('p:cNvGrpSpPr', null);

        // p:nvPr
        $objWriter->writeElement('p:nvPr',null);



        // ## p:nvGrpSpPr
        $objWriter->endElement();

        // p:grpSpPr
        $objWriter->startElement('p:grpSpPr');

        // a:xfrm
        $objWriter->startElement('a:xfrm');

        // a:off
        $objWriter->startElement('a:off');
        $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($pNote->getOffsetX()));
        $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($pNote->getOffsetY()));
        $objWriter->endElement(); // a:off

        // a:ext
        $objWriter->startElement('a:ext');
        $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($pNote->getExtentX()));
        $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($pNote->getExtentY()));
        $objWriter->endElement(); // a:ext

        // a:chOff
        $objWriter->startElement('a:chOff');
        $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($pNote->getOffsetX()));
        $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($pNote->getOffsetY()));
        $objWriter->endElement(); // a:chOff

        // a:chExt
        $objWriter->startElement('a:chExt');
        $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($pNote->getExtentX()));
        $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($pNote->getExtentY()));
        $objWriter->endElement(); // a:chExt

        // ## a:xfrm
        $objWriter->endElement();

        // ## p:grpSpPr
        $objWriter->endElement();


        $objWriter->startElement('p:sp');
        $objWriter->startElement('p:nvSpPr');

        $objWriter->startElement('p:cNvPr');
        $objWriter->writeAttribute('id','1');
        $objWriter->writeAttribute('name','Notes Placeholder');
        $objWriter->endElement(); //p:cNvPr

        $objWriter->startElement('p:cNvSpPr');

        $objWriter->startElement('a:spLocks');
        $objWriter->writeAttribute('noGrp','1');
        $objWriter->endElement();//a:spLocks

        $objWriter->endElement(); //p:cNvSpPr

        $objWriter->startElement('p:nvPr');

        $objWriter->startElement('p:ph');
        $objWriter->writeAttribute('type','body');
        $objWriter->writeAttribute('idx','1');
        $objWriter->endElement(); //p:ph

        $objWriter->endElement();//p:nvPr

        $objWriter->endElement();//p:nvSpPr

        $objWriter->writeElement('p:spPr',null);


        $objWriter->startElement('p:txBody');
        $objWriter->writeElement('a:bodyPr',null);
        $objWriter->writeElement('a:lstStyle',null);

        // Loop shapes
        $shapes  = $pNote->getShapeCollection();
        foreach ($shapes as $shape) {
            // Check type
            if ($shape instanceof RichText) {
               $paragraphs = $shape->getParagraphs();
               $this->writeParagraphs($objWriter, $paragraphs);
            }
        }

        $objWriter->endElement();//p:txBody
        //p:sp
        $objWriter->endElement();

        //p:spTree
        $objWriter->endElement();
        //p:cSld
        $objWriter->endElement();

        // > p:notes
        $objWriter->endElement();

        // Return
        return $objWriter->getData();
    }

from phppresentation.

Progi1984 avatar Progi1984 commented on May 21, 2024

@JewrassicPark @dung1764 If you could test with the last version of the develop branch, and give some feedback (success & fail), I could close or continue this issue. Thanks.

from phppresentation.

JewrassicPark avatar JewrassicPark commented on May 21, 2024

Works for me, but to be fair it's the code I already checked so it's not a great test.

from phppresentation.

Progi1984 avatar Progi1984 commented on May 21, 2024

I finally tested on my Windows Computer with PowerPoint & PowerPoint online and it works. So I close this issue.

from phppresentation.

JewrassicPark avatar JewrassicPark commented on May 21, 2024

I've found a case in which it causes powerpoint to crash and it's not
trivial

If you create a first slide without notes then make subsequent slides with
notes, powerpoint can't read the file. I'm currently looking into the bug.

On Thu, Jan 8, 2015 at 7:00 AM, Progi1984 [email protected] wrote:

I finally tested on my Windows Computer with PowerPoint & PowerPoint
online and it works. So I close this issue.


Reply to this email directly or view it on GitHub
#63 (comment)
.

from phppresentation.

JewrassicPark avatar JewrassicPark commented on May 21, 2024

the relationship is either with the _rels directory in notesslides or the
notemaster but I couldn't find the exact relationship

right now I've just patched my project by adding a placeholder note for
slides that don't have notes but this isnt a good solution and should be
opened as a bug

On Thu, Jan 8, 2015 at 1:03 PM, Derek Cohen [email protected] wrote:

I've found a case in which it causes powerpoint to crash and it's not
trivial

If you create a first slide without notes then make subsequent slides with
notes, powerpoint can't read the file. I'm currently looking into the bug.

On Thu, Jan 8, 2015 at 7:00 AM, Progi1984 [email protected]
wrote:

I finally tested on my Windows Computer with PowerPoint & PowerPoint
online and it works. So I close this issue.


Reply to this email directly or view it on GitHub
#63 (comment)
.

from phppresentation.

Progi1984 avatar Progi1984 commented on May 21, 2024

@JewrassicPark Could you open it as a new bug with a sample code ?

from phppresentation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.