https://issues.apache.org/bugzilla/show_bug.cgi?id=55164

Jan Tošovský <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Jan Tošovský <[email protected]> ---
A default Notes Master is provided as XML file in the resources folder. It is
parsed and then copied completely (using a new constructor) into a new Notes
Master object. Actually this template should be replaced with the 'EN' variant
(I run on CZ locale).

For creating Note Slides I am reusing Notes Master content directly as there is
no Layout analogy as in case of standard slides.

Important relation is between the Notes Master and the Theme object as some
font properties are required during the processing. For the Notes Master I use
the theme of the first slide.

But I had to use one nasty hack in the XSLFTextParagraph class. It supposes
there are text styles defined in the Master, but these are not present in the
Notes Master. I haven't found a way how to determine the kind of the Master so
I placed another try into the exception fallback. It works, but...

As there is only one placeholder on the Notes Slide, we could consider placing
the following verbose lookup code directly into the Note Slide class and call
notesSlide.setNote("My Note") instead.

InputStream is = new FileInputStream("D:/test_multi.pptx");
XMLSlideShow slideShow = new XMLSlideShow(is);
for (XSLFSlide slide : slideShow.getSlides()) {
    XSLFNotes notesSlide = slideShow.createNotesSlide(slide);
    for (XSLFTextShape shape : notesSlide.getPlaceholders()) {
        if (shape.getTextType() == Placeholder.BODY) {
            shape.setText("My Note\nMy Note");
            break;
        }
    }
}            
FileOutputStream out = new FileOutputStream("D:/test_multi_notes.pptx");
slideShow.write(out);
out.close();

I would also prefer renaming XSLFNotes class into XSLFNotesSlide as it confused
me many times in the beginning.

-- 
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]

Reply via email to