Bug 47904

Summary: Update text styles in HSLF MasterSlide
Product: POI Reporter: Dandre <dandrejvv>
Component: HSLFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: dandrejvv
Priority: P2    
Version: 3.2-FINAL   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Dandre 2009-09-25 08:25:53 UTC
I have tried to change the MasterSlide's RichTextRun attribute, i.e. setting FontName or anything else and it pops up with a NullReferenceException.

I have traced it in the source to these lines:
TextRun.java: 519 RecordContainer runAtomsParent = _headerAtom.getParentRecord();
TextHeaderAtom.java: 55 public RecordContainer getParentRecord() { return parentRecord; }

The 'parentRecord' is null.
It is then tried to be called here:
TextRun.java: 524 runAtomsParent.addChildAfter(_styleAtom, addAfter);

Since 'runAtomsParent' is null, we get the exception.

Here is some example code of what I did:

SlideMaster master = mSlideshow.getSlidesMasters()[0];
TextShape title = (TextShape) master.getShapes()[0];
RichTextRun titleFormat = title.getTextRun().getRichTextRuns()[0];
titleFormat.setFontName("Franklin Gothic Book");
titleFormat.setShadowed(true);
titleFormat.setFontSize(44);
titleFormat.setFontColor(Color.white);
titleFormat.setAlignment(TextBox.AlignCenter);
master.addShape(title);

mSlideShow is as you have guessed, my SlideShow object.
Comment 1 Andreas Beeker 2015-11-30 23:36:20 UTC
This was fixed as part of r1717351
It's now possible to set the master text styles via the corresponding text 
shapes, hence the rename of the bug entry