Created attachment 22064 [details] The input ppt -- see slide 1 before running Hello: If you run the code below: ------------------------------------------ package hslf; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.hslf.HSLFSlideShow; import org.apache.poi.hslf.model.Shape; import org.apache.poi.hslf.model.Slide; import org.apache.poi.hslf.model.TextBox; import org.apache.poi.hslf.usermodel.RichTextRun; import org.apache.poi.hslf.usermodel.SlideShow; public class InsertText { public InsertText() { } public static void main(String[] args) throws IOException { InsertText insertText = new InsertText(); insertText.insertText(); } public void insertText() throws IOException { SlideShow ppt = new SlideShow(new HSLFSlideShow("c:/test/bug2.ppt")); Slide slide1 = ppt.getSlides()[1]; TextBox res = new TextBox(); res.setAnchor(new java.awt.Rectangle(60, 150, 700, 100)); res.setText("I am italic-false, bold-true inserted text"); res.setHorizontalAlignment(TextBox.AlignLeft); res.setVerticalAlignment(TextBox.AlignCenter); RichTextRun rt2 = res.getTextRun().getRichTextRuns()[0]; rt2.setFontSize(32); rt2.setItalic(false); rt2.setBulletOffset(0); rt2.setBold(true); rt2.setBullet(true); rt2.setBulletChar('\u00B7'); rt2.setFontName("Arial Narrow"); slide1.addShape(res); FileOutputStream out = new FileOutputStream("c:/test/bug2.ppt"); ppt.write(out); out.close(); } } -------------------------------- the inserted text will not be bold and will be italic. In addition, all text on every slide that was bold and not italic loses its boldness and becomes italic. For example, the text on slide 1 in bug.ppt reacts this way when text is inserted on slide 2. Eric Hamacher
when inserting images the following message is generated: Found a TextHeaderAtom not followed by a TextBytesAtom or TextCharsAtom: Followed by 4006
Just a note: The input file is uploaded to a web app by a user, altered, then downloaded to the user.
Partially fixed. Styles are now preserved across read/write. The inserted text still has wrong styles. Actually, HSLF sets the style bytes correctly. It is PowerPoint who has special master-level style info which causes the text style to be inverted. setBold(false) causes the text to be bold and setBold(true) to be not-bold. Which version of PowerPoint was used to create/edit this ppt? Yegor
Hi, when adding new image to the existing excel file(which contains already pictures) the previous pictures are not visisble. Please give me the solution Thanks, Shafiulla
Not sure if this is still relevant, it seems to be about HSLF only the last comment is about Excel, let's create new bug entries if there is still a problem with the latest slideshow-code which was pretty much rewritten lately.
Fixed with r1711704 The problem was, that the bold state was inherited from the slide layout and the method to set the text (paragraph) properties hasn't checked for that inheritance ... Furthermore there was an error in setting bullet styles.