private CTPresentation _presentation;
private List<XSLFSlide> _slides;
private Map<String, XSLFSlideMaster> _masters;
+ private List<XSLFPictureData> _pictures;
+ private XSLFTableStyles _tableStyles;
private XSLFNotesMaster _notesMaster;
private XSLFCommentAuthors _commentAuthors;
- protected List<XSLFPictureData> _pictures;
public XMLSlideShow() {
this(empty());
} else if (p instanceof XSLFSlideMaster) {
XSLFSlideMaster master = (XSLFSlideMaster)p;
_masters.put(p.getPackageRelationship().getId(), master);
+ }else if (p instanceof XSLFTableStyles){
+ _tableStyles = (XSLFTableStyles)p;
} else if (p instanceof XSLFNotesMaster) {
_notesMaster = (XSLFNotesMaster)p;
} else if (p instanceof XSLFCommentAuthors) {
return imageNumber - 1;
}
+ public XSLFTableStyles getTableStyles(){
+ return _tableStyles;
+ }
+
}
null
);
+ public static final XSLFRelation TABLE_STYLES = new XSLFRelation(
+ "application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml",
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles",
+ "/ppt/tableStyles.xml",
+ XSLFTableStyles.class
+ );
+
private XSLFRelation(String type, String rel, String defaultName, Class<? extends POIXMLDocumentPart> cls) {
super(type, rel, defaultName, cls);
--- /dev/null
+/*\r
+ * ====================================================================\r
+ * Licensed to the Apache Software Foundation (ASF) under one or more\r
+ * contributor license agreements. See the NOTICE file distributed with\r
+ * this work for additional information regarding copyright ownership.\r
+ * The ASF licenses this file to You under the Apache License, Version 2.0\r
+ * (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ====================================================================\r
+ */\r
+\r
+package org.apache.poi.xslf.usermodel;\r
+\r
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTableStyle;\r
+\r
+/**\r
+ * Represents a table in a .pptx presentation\r
+ *\r
+ * @author Yegor Kozlov\r
+ */\r
+public class XSLFTableStyle {\r
+ private CTTableStyle _tblStyle;\r
+\r
+ /*package*/ XSLFTableStyle(CTTableStyle style){\r
+ _tblStyle = style;\r
+ }\r
+\r
+ public CTTableStyle getXmlObject(){\r
+ return _tblStyle;\r
+ }\r
+\r
+ public String getStyleName(){\r
+ return _tblStyle.getStyleName();\r
+ }\r
+\r
+ public String getStyleId(){\r
+ return _tblStyle.getStyleId();\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+package org.apache.poi.xslf.usermodel;
+
+import org.apache.poi.POIXMLDocumentPart;
+import org.apache.poi.openxml4j.opc.PackagePart;
+import org.apache.poi.openxml4j.opc.PackageRelationship;
+import org.apache.poi.util.Beta;
+import org.apache.xmlbeans.XmlException;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTableStyle;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTableStyleList;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Collections;
+
+@Beta
+public class XSLFTableStyles extends POIXMLDocumentPart implements Iterable<XSLFTableStyle>{
+ private CTTableStyleList _tblStyleLst;
+ private List<XSLFTableStyle> _styles;
+
+ public XSLFTableStyles(){
+ super();
+ }
+
+ public XSLFTableStyles(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
+ super(part, rel);
+
+ _tblStyleLst = CTTableStyleList.Factory.parse(getPackagePart().getInputStream());
+ _styles = new ArrayList<XSLFTableStyle>(_tblStyleLst.sizeOfTblStyleArray());
+ for(CTTableStyle c : _tblStyleLst.getTblStyleList()){
+ _styles.add(new XSLFTableStyle(c));
+ }
+ }
+
+ public CTTableStyleList getXmlObject(){
+ return _tblStyleLst;
+ }
+
+ public Iterator<XSLFTableStyle> iterator(){
+ return _styles.iterator();
+ }
+
+ public List<XSLFTableStyle> getStyles(){
+ return Collections.unmodifiableList(_styles);
+ }
+}
\ No newline at end of file
--- /dev/null
+/* ====================================================================\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to You under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+==================================================================== */\r
+package org.apache.poi.xslf.usermodel;\r
+\r
+import junit.framework.TestCase;\r
+\r
+import java.awt.*;\r
+import java.awt.geom.Ellipse2D;\r
+import java.awt.geom.GeneralPath;\r
+import java.util.*;\r
+import java.util.List;\r
+\r
+import org.apache.poi.xslf.XSLFTestDataSamples;\r
+import org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame;\r
+\r
+/**\r
+ * @author Yegor Kozlov\r
+ */\r
+public class TestXSLFTableStyles extends TestCase {\r
+\r
+ public void testRead(){\r
+ XMLSlideShow ppt = new XMLSlideShow();\r
+ XSLFTableStyles tblStyles = ppt.getTableStyles();\r
+ assertNotNull(tblStyles);\r
+\r
+ assertEquals(10, tblStyles.getStyles().size());\r
+ }\r
+}
\ No newline at end of file