You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2015/04/20 19:58:04 UTC

[Bug 57835] New: XSLFSlide.importContent fails to create valid slide with Charts and Notes in slide

https://bz.apache.org/bugzilla/show_bug.cgi?id=57835

            Bug ID: 57835
           Summary: XSLFSlide.importContent fails to create valid slide
                    with Charts and Notes in slide
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLF
          Assignee: dev@poi.apache.org
          Reporter: apire@sparklyvernis.com

Created attachment 32666
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=32666&action=edit
Slide Source and Destination (couple Printshots)

Have a presentation with a chart and some notes.

Running the code below using the resources attached to this issue (src.pptx)
generates the dst.pptx, such file is not being generated correctly, charts and
notes are missing as shown in the attached pictures. The dst file can not be
opened using powerpoint.

POI:
poi-ooxml-3.11-20141221 (Latest stable as of today)
Java:
jdk1.6.0_32 (32 bits)

<TESTCODE>
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.poi.xslf.usermodel.XSLFSlideLayout;
import org.apache.poi.xslf.usermodel.XSLFSlideMaster;

public class POITest {

    public static void main(String[] args) {
        try {
            String fnames[] = {"src.pptx"};

            OutputStream fos = new FileOutputStream("dst.pptx");
            XMLSlideShow ppt_out = new XMLSlideShow();

            for (String file : fnames) {
                FileInputStream fis = new FileInputStream(file);
                XMLSlideShow src = new XMLSlideShow(fis);


                for(XSLFSlide srcSlide : src.getSlides()){ 
                    XSLFSlide newSlide = ppt_out.createSlide(); 


                    XSLFSlideLayout src_sl = srcSlide.getSlideLayout(); 
                    XSLFSlideMaster src_sm = srcSlide.getSlideMaster(); 

                    XSLFSlideLayout new_sl = newSlide.getSlideLayout(); 
                    XSLFSlideMaster new_sm = newSlide.getSlideMaster(); 

                    // copy source layout to the new layout 
                    new_sl.importContent(src_sl); 
                    // copy source master to the new master 
                    new_sm.importContent(src_sm); 


                    newSlide.importContent(srcSlide);                    
                }                 

                fis.close();

            }

            ppt_out.write(fos);
            fos.close();

        } catch (IOException e) {

        }
    }

}
</TESTCODE>

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57835] XSLFSlide.importContent fails to create valid slide with Charts and Notes in slide

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57835

--- Comment #4 from Alain Fagot Bearez <Al...@cua.li> ---
A partial fix (only handling the charts) is available as pull request #68:

https://github.com/apache/poi/pull/68

However the changes are not focused in solving only this issue, but in
preparing for a shared code base for charts handling.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: [Bug 57835] New: XSLFSlide.importContent fails to create valid slide with Charts and Notes in slide

Posted by goobycle <go...@163.com>.
I am also experiencing this bug.poi version is 3.15-beta2           
XMLSlideShow pptx = new XMLSlideShow(new FileInputStream(PPT_TEMPLATE));           
XSLFSlide slide = pptx.getSlides()[0];           
pptx.createSlide().importContent(slide);            OutputStream out = new
FileOutputStream("output/pie-chart-demo-output.pptx");           
pptx.write(out);            out.close();when I open the
pie-chart-demo-output.pptx,there will be a problem to fix. And fixing
over,the copy slide disappears.Is Your problem solved? How to do ? Help
me.Many thanks.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Bug-57835-New-XSLFSlide-importContent-fails-to-create-valid-slide-with-Charts-and-Notes-in-slide-tp5718525p5724344.html
Sent from the POI - Dev mailing list archive at Nabble.com.

[Bug 57835] XSLFSlide.importContent fails to create valid slide with Charts and Notes in slide

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57835

Ashok Kumar <as...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ashok.panghal@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57835] XSLFSlide.importContent fails to create valid slide with Charts and Notes in slide

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57835

Alain Fagot Bearez <Al...@cua.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from Alain Fagot Bearez <Al...@cua.li> ---
While importing the charts has been available since POI 4.0.0, only with
revision  r1886338 are the notes also imported.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57835] XSLFSlide.importContent fails to create valid slide with Charts and Notes in slide

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57835

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |3.11-FINAL

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57835] XSLFSlide.importContent fails to create valid slide with Charts and Notes in slide

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57835

Alexander <ap...@sparklyvernis.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |apire@sparklyvernis.com
                 OS|                            |All

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57835] XSLFSlide.importContent fails to create valid slide with Charts and Notes in slide

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57835

--- Comment #1 from Nicolas Cailloux <ni...@linkfluence.com> ---
I also experience this bug. 
It seems POI succeeds in copying object, but fails in the type. 
Calling "getShapeName" results in the same name, but when trying to convert,
here is what it says: 
org.apache.poi.POIXMLDocumentPart cannot be cast to
org.apache.poi.xslf.usermodel.XSLFChart
org.apache.poi.xslf.usermodel.XSLFPictureData cannot be cast to
org.apache.poi.xslf.usermodel.XSLFChart

Good news: the generated XML for the new chart object is the same as the
original XML. 
The relation ID is the same (in my case, "rId2"). 

However, when checking in relations file for the slide, "rId2" is not bound to
a chart anymore, but to an image. 
Also, some relations are simply missing. 

This seems to be a bug about relationships.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57835] XSLFSlide.importContent fails to create valid slide with Charts and Notes in slide

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57835

Nicolas Cailloux <ni...@linkfluence.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major
            Version|3.11-FINAL                  |3.13-FINAL

--- Comment #2 from Nicolas Cailloux <ni...@linkfluence.com> ---
When digging in PPTX archive, the charts are not copied. I have as many charts
in the new files than in the original one.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57835] XSLFSlide.importContent fails to create valid slide with Charts and Notes in slide

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57835

Higune <st...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |steffen.prendke@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57835] XSLFSlide.importContent fails to create valid slide with Charts and Notes in slide

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57835

Sergei Malafeev <se...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sergeymalafeev@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57835] XSLFSlide.importContent fails to create valid slide with Charts and Notes in slide

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57835

antonin pa <an...@orange.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |antonin.perrotaudet@orange.
                   |                            |com

--- Comment #3 from antonin pa <an...@orange.com> ---
Encountering the exact same bug, that prevents me from using POI to generate
power point presentations : I don't see how to *insert* graphs while building a
presentation because of this bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org