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: [email protected]
Reporter: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]