* Fetch the value of the given Paragraph related TextProp. Returns null if\r
* that TextProp isn't present. If the TextProp isn't present, the value\r
* from the appropriate Master Sheet will apply.\r
+ * \r
+ * The propName can be a comma-separated list, in case multiple equivalent values\r
+ * are queried\r
*/\r
protected static TextProp getPropVal(TextPropCollection props, String propName, HSLFTextParagraph paragraph) {\r
- TextProp prop = props.findByName(propName);\r
- if (prop != null) return prop;\r
+ String propNames[] = propName.split(",");\r
+ for (String pn : propNames) {\r
+ TextProp prop = props.findByName(pn);\r
+ if (prop != null) return prop;\r
+ }\r
\r
BitMaskTextProp maskProp = (BitMaskTextProp) props.findByName(ParagraphFlagsTextProp.NAME);\r
boolean hardAttribute = (maskProp != null && maskProp.getValue() == 0);\r
}\r
\r
boolean isChar = props.getTextPropType() == TextPropType.character;\r
- return master.getStyleAttribute(txtype, paragraph.getIndentLevel(), propName, isChar);\r
+ \r
+ for (String pn : propNames) {\r
+ TextProp prop = master.getStyleAttribute(txtype, paragraph.getIndentLevel(), pn, isChar);\r
+ if (prop != null) return prop;\r
+ }\r
+ \r
+ return null;\r
}\r
\r
/**\r
if (sheet == null || slideShow == null) {
return _fontFamily;
}
- TextProp tp = getPropVal(characterStyle, "font.index", parentParagraph);
+ TextProp tp = getPropVal(characterStyle, "font.index,asian.font.index,ansi.font.index,symbol.font.index", parentParagraph);
if (tp == null) { return null; }
return slideShow.getFontCollection().getFontWithId(tp.getValue());
}
import org.apache.poi.hslf.extractor.PowerPointExtractor;
import org.apache.poi.hslf.model.HeadersFooters;
import org.apache.poi.hslf.record.Document;
-import org.apache.poi.hslf.record.OEPlaceholderAtom;
import org.apache.poi.hslf.record.Record;
-import org.apache.poi.hslf.record.RoundTripHFPlaceholder12;
import org.apache.poi.hslf.record.SlideListWithText;
import org.apache.poi.hslf.record.SlideListWithText.SlideAtomsSet;
import org.apache.poi.hslf.record.TextHeaderAtom;
@Test
public void bug58159() throws IOException {
- File sample = HSLFTestDataSamples.getSampleFile("bug58159_headers-and-footers.ppt");
- HSLFSlideShow ppt = (HSLFSlideShow)SlideShowFactory.create(sample);
+ HSLFSlideShow ppt = open("bug58159_headers-and-footers.ppt");
HeadersFooters hf = ppt.getSlideHeadersFooters();
assertNull(hf.getHeaderText());
assertEquals("Slide footer", hf.getFooterText());
}
ppt.close();
}
+
+ @Test
+ public void bug55030() throws IOException {
+ HSLFSlideShow ppt = open("bug55030.ppt");
+
+ String expFamily = "\u96b6\u4e66";
+
+ HSLFSlide sl = ppt.getSlides().get(0);
+ for (List<HSLFTextParagraph> paraList : sl.getTextParagraphs()) {
+ for (HSLFTextParagraph htp : paraList) {
+ for (HSLFTextRun htr : htp) {
+ String actFamily = htr.getFontFamily();
+ assertEquals(expFamily, actFamily);
+ }
+ }
+ }
+
+ ppt.close();
+ }
private static HSLFSlideShow open(String fileName) throws IOException {
File sample = HSLFTestDataSamples.getSampleFile(fileName);