Bug 47904 - Update text styles in HSLF MasterSlide
Summary: Update text styles in HSLF MasterSlide
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSLF (show other bugs)
Version: 3.2-FINAL
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-25 08:25 UTC by Dandre
Modified: 2015-11-30 23:36 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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