<!-- Don't forget to update status.xml too! -->
<release version="3.0.2-FINAL" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="add">Support for tables in HSLF</action>
+ <action dev="POI-DEVELOPERS" type="fix">43781 - Fix for extracting text from TextBoxes HSLF in</action>
<action dev="POI-DEVELOPERS" type="fix">Improve JavaDocs relating to hssf font and fill colourings</action>
<action dev="POI-DEVELOPERS" type="add">44095, 44097, 44099 - [PATCH] Support for Mid, Replace and Substitute excel functions</action>
<action dev="POI-DEVELOPERS" type="add">44055 - [PATCH] Support for getting the from field from HSMF messages</action>
<li><link href="#Fill">How to work with slide/shape background</link></li>
<li><link href="#Bullets">How to create bulleted lists</link></li>
<li><link href="#Hyperlinks">Hyperlinks</link></li>
+ <li><link href="#Tables">Tables</link></li>
</ul>
</section>
<section><title>Features</title>
}
</source>
</section>
+ <anchor id="Tables"/>
+ <section><title>How to create tables</title>
+ <source>
+ //table data
+ String[][] data = {
+ {"INPUT FILE", "NUMBER OF RECORDS"},
+ {"Item File", "11,559"},
+ {"Vendor File", "300"},
+ {"Purchase History File", "10,000"},
+ {"Total # of requisitions", "10,200,038"}
+ };
+
+ SlideShow ppt = new SlideShow();
+
+ Slide slide = ppt.createSlide();
+ //create a table of 5 rows and 2 columns
+ Table table = new Table(5, 2);
+ for (int i = 0; i < data.length; i++) {
+ for (int j = 0; j < data[i].length; j++) {
+ TableCell cell = table.getCell(i, j);
+ cell.setText(data[i][j]);
+
+ RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];
+ rt.setFontName("Arial");
+ rt.setFontSize(10);
+
+ cell.setVerticalAlignment(TextBox.AnchorMiddle);
+ cell.setHorizontalAlignment(TextBox.AlignCenter);
+ }
+ }
+
+ //set table borders
+ Line border = table.createBorder();
+ border.setLineColor(Color.black);
+ border.setLineWidth(1.0);
+ table.setAllBorders(border);
+
+ //set width of the 1st column
+ table.setColumnWidth(0, 300);
+ //set width of the 2nd column
+ table.setColumnWidth(1, 150);
+
+ slide.addShape(table);
+ table.moveTo(100, 100);
+
+ FileOutputStream out = new FileOutputStream("hslf-table.ppt");
+ ppt.write(out);
+ out.close();
+
+ </source>
+ </section>
</section>
</section>
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.0.2-FINAL" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="add">Support for tables in HSLF</action>
+ <action dev="POI-DEVELOPERS" type="fix">43781 - Fix for extracting text from TextBoxes HSLF in</action>
<action dev="POI-DEVELOPERS" type="fix">Improve JavaDocs relating to hssf font and fill colourings</action>
<action dev="POI-DEVELOPERS" type="add">44095, 44097, 44099 - [PATCH] Support for Mid, Replace and Substitute excel functions</action>
<action dev="POI-DEVELOPERS" type="add">44055 - [PATCH] Support for getting the from field from HSMF messages</action>
--- /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
+package org.apache.poi.hslf.examples;\r
+\r
+import org.apache.poi.hslf.usermodel.SlideShow;\r
+import org.apache.poi.hslf.usermodel.RichTextRun;\r
+import org.apache.poi.hslf.model.*;\r
+\r
+import java.awt.*;\r
+import java.io.FileOutputStream;\r
+\r
+/**\r
+ * Demonstrates how to create tables\r
+ * \r
+ * @author Yegor Kozlov\r
+ */\r
+public class TableDemo {\r
+\r
+ public static void main(String[] args) throws Exception {\r
+\r
+ //test data for the first taable\r
+ String[][] txt1 = {\r
+ {"INPUT FILE", "NUMBER OF RECORDS"},\r
+ {"Item File", "11,559"},\r
+ {"Vendor File", "502"},\r
+ {"Purchase History File - # of PO\u2019s\r(12/01/04 - 05/31/06)", "12,852"},\r
+ {"Purchase History File - # of PO Lines\r(12/01/04 - 05/31/06)", "53,523" },\r
+ {"Total PO History Spend", "$10,172,038"}\r
+ };\r
+\r
+ SlideShow ppt = new SlideShow();\r
+\r
+ Slide slide = ppt.createSlide();\r
+\r
+ //six rows, two columns\r
+ Table table1 = new Table(6, 2);\r
+ for (int i = 0; i < txt1.length; i++) {\r
+ for (int j = 0; j < txt1[i].length; j++) {\r
+ TableCell cell = table1.getCell(i, j);\r
+ cell.setText(txt1[i][j]);\r
+ RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];\r
+ rt.setFontName("Arial");\r
+ rt.setFontSize(10);\r
+ if(i == 0){\r
+ cell.getFill().setForegroundColor(new Color(227, 227, 227));\r
+ } else {\r
+ rt.setBold(true);\r
+ }\r
+ cell.setVerticalAlignment(TextBox.AnchorMiddle);\r
+ cell.setHorizontalAlignment(TextBox.AlignCenter);\r
+ }\r
+ }\r
+\r
+ Line border1 = table1.createBorder();\r
+ border1.setLineColor(Color.black);\r
+ border1.setLineWidth(1.0);\r
+ table1.setAllBorders(border1);\r
+\r
+ table1.setColumnWidth(0, 300);\r
+ table1.setColumnWidth(1, 150);\r
+\r
+ slide.addShape(table1);\r
+ int pgWidth = ppt.getPageSize().width;\r
+ table1.moveTo((pgWidth - table1.getAnchor().width)/2, 100);\r
+\r
+ //test data for the second taable\r
+ String[][] txt2 = {\r
+ {"Data Source"},\r
+ {"CAS Internal Metrics - Item Master Summary\r" +\r
+ "CAS Internal Metrics - Vendor Summary\r" +\r
+ "CAS Internal Metrics - PO History Summary"}\r
+ };\r
+\r
+ //two rows, one column\r
+ Table table2 = new Table(2, 1);\r
+ for (int i = 0; i < txt2.length; i++) {\r
+ for (int j = 0; j < txt2[i].length; j++) {\r
+ TableCell cell = table2.getCell(i, j);\r
+ cell.setText(txt2[i][j]);\r
+ RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];\r
+ rt.setFontSize(10);\r
+ rt.setFontName("Arial");\r
+ if(i == 0){\r
+ cell.getFill().setForegroundColor(new Color(0, 51, 102));\r
+ rt.setFontColor(Color.white);\r
+ rt.setBold(true);\r
+ rt.setFontSize(14);\r
+ cell.setHorizontalAlignment(TextBox.AlignCenter);\r
+ } else {\r
+ rt.setBullet(true);\r
+ rt.setFontSize(12);\r
+ cell.setHorizontalAlignment(TextBox.AlignLeft);\r
+ }\r
+ cell.setVerticalAlignment(TextBox.AnchorMiddle);\r
+ }\r
+ }\r
+ table2.setColumnWidth(0, 300);\r
+ table2.setRowHeight(0, 30);\r
+ table2.setRowHeight(1, 70);\r
+\r
+ Line border2 = table2.createBorder();\r
+ table2.setOutsideBorders(border2);\r
+\r
+ slide.addShape(table2);\r
+ table2.moveTo(200, 400);\r
+\r
+ FileOutputStream out = new FileOutputStream("hslf-table.ppt");\r
+ ppt.write(out);\r
+ out.close();\r
+\r
+ }\r
+}\r
EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
if (color == null) {
Shape.setEscherProperty(opt, EscherProperties.FILL__FILLCOLOR, -1);
+ Shape.setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150010);
}
else {
int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
Shape.setEscherProperty(opt, EscherProperties.FILL__FILLCOLOR, rgb);
+ Shape.setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150011);
}
}
int rgb = p1.getPropertyValue();
if (rgb >= 0x8000000) {
int idx = rgb % 0x8000000;
- ColorSchemeAtom ca = getSheet().getColorScheme();
- if(idx >= 0 && idx <= 7) rgb = ca.getColor(idx);
+ if(getSheet() != null) {
+ ColorSchemeAtom ca = getSheet().getColorScheme();
+ if(idx >= 0 && idx <= 7) rgb = ca.getColor(idx);
+ }
}
Color tmp = new Color(rgb, true);
clr = new Color(tmp.getBlue(), tmp.getGreen(), tmp.getRed());
int rgb = p1.getPropertyValue();
if (rgb >= 0x8000000) {
int idx = rgb % 0x8000000;
- ColorSchemeAtom ca = getSheet().getColorScheme();
- rgb = ca.getColor(idx);
+ if(getSheet() != null) {
+ ColorSchemeAtom ca = getSheet().getColorScheme();
+ rgb = ca.getColor(idx);
+ }
}
Color tmp = new Color(rgb, true);
clr = new Color(tmp.getBlue(), tmp.getGreen(), tmp.getRed());
--- /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
+package org.apache.poi.hslf.model;\r
+\r
+import org.apache.poi.ddf.*;\r
+import org.apache.poi.util.LittleEndian;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+import java.util.Iterator;\r
+import java.awt.*;\r
+\r
+/**\r
+ * Represents a table in a PowerPoint presentation\r
+ * \r
+ * @author Yegor Kozlov\r
+ */\r
+public class Table extends ShapeGroup {\r
+\r
+ protected static final int BORDER_TOP = 1;\r
+ protected static final int BORDER_RIGHT = 2;\r
+ protected static final int BORDER_BOTTOM = 3;\r
+ protected static final int BORDER_LEFT = 4;\r
+\r
+ protected static final int BORDERS_ALL = 5;\r
+ protected static final int BORDERS_OUTSIDE = 6;\r
+ protected static final int BORDERS_INSIDE = 7;\r
+ protected static final int BORDERS_NONE = 8;\r
+\r
+\r
+ protected TableCell[][] cells;\r
+\r
+ /**\r
+ * Create a new Table of the given number of rows and columns\r
+ *\r
+ * @param numrows the number of rows\r
+ * @param numcols the number of columns\r
+ */\r
+ public Table(int numrows, int numcols) {\r
+ super();\r
+\r
+ int x=0, y=0, tblWidth=0, tblHeight=0;\r
+ cells = new TableCell[numrows][numcols];\r
+ for (int i = 0; i < cells.length; i++) {\r
+ x = 0;\r
+ for (int j = 0; j < cells[i].length; j++) {\r
+ cells[i][j] = new TableCell(this);\r
+ Rectangle anchor = new Rectangle(x, y, TableCell.DEFAULT_WIDTH, TableCell.DEFAULT_HEIGHT);\r
+ cells[i][j].setAnchor(anchor);\r
+ x += TableCell.DEFAULT_WIDTH;\r
+ }\r
+ y += TableCell.DEFAULT_HEIGHT;\r
+ }\r
+ tblWidth = x;\r
+ tblHeight = y;\r
+ setAnchor(new Rectangle(0, 0, tblWidth, tblHeight));\r
+\r
+ EscherContainerRecord spCont = (EscherContainerRecord) getSpContainer().getChild(0);\r
+ List lst = spCont.getChildRecords();\r
+ EscherOptRecord opt = new EscherOptRecord();\r
+ opt.setRecordId((short)0xF122);\r
+ opt.addEscherProperty(new EscherSimpleProperty((short)0x39F, 1));\r
+ EscherArrayProperty p = new EscherArrayProperty((short)0x43A0, false, null);\r
+ p.setSizeOfElements(0x0004);\r
+ p.setNumberOfElementsInArray(numrows);\r
+ p.setNumberOfElementsInMemory(numrows);\r
+ opt.addEscherProperty(p);\r
+ lst.add(lst.size()-1, opt);\r
+\r
+ }\r
+\r
+ /**\r
+ * Create a Table object and initilize it from the supplied Record container.\r
+ *\r
+ * @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape\r
+ * @param parent the parent of the shape\r
+ */\r
+ protected Table(EscherContainerRecord escherRecord, Shape parent) {\r
+ super(escherRecord, parent);\r
+ }\r
+\r
+ /**\r
+ * Gets a cell\r
+ *\r
+ * @param row the row index (0-based)\r
+ * @param col the column index (0-based)\r
+ * @return the cell\r
+ */\r
+ public TableCell getCell(int row, int col) {\r
+ return cells[row][col];\r
+ }\r
+\r
+ public int getNumberOfColumns() {\r
+ return cells[0].length;\r
+ }\r
+ public int getNumberOfRows() {\r
+ return cells.length;\r
+ }\r
+\r
+ protected void afterInsert(Sheet sh){\r
+ EscherContainerRecord spCont = (EscherContainerRecord) getSpContainer().getChild(0);\r
+ List lst = spCont.getChildRecords();\r
+ EscherOptRecord opt = (EscherOptRecord)lst.get(lst.size()-2);\r
+ EscherArrayProperty p = (EscherArrayProperty)opt.getEscherProperty(1);\r
+ for (int i = 0; i < cells.length; i++) {\r
+ TableCell cell = cells[i][0];\r
+ int rowHeight = cell.getAnchor().height*MASTER_DPI/POINT_DPI;\r
+ byte[] val = new byte[4];\r
+ LittleEndian.putInt(val, rowHeight);\r
+ p.setElement(i, val);\r
+ for (int j = 0; j < cells[i].length; j++) {\r
+ TableCell c = cells[i][j];\r
+ addShape(c);\r
+\r
+ Line bt = c.getBorderTop();\r
+ if(bt != null) addShape(bt);\r
+\r
+ Line br = c.getBorderRight();\r
+ if(br != null) addShape(br);\r
+\r
+ Line bb = c.getBorderBottom();\r
+ if(bb != null) addShape(bb);\r
+\r
+ Line bl = c.getBorderLeft();\r
+ if(bl != null) addShape(bl);\r
+\r
+ }\r
+ }\r
+\r
+ }\r
+\r
+ /**\r
+ * Sets the row height.\r
+ *\r
+ * @param row the row index (0-based)\r
+ * @param height the height to set (in pixels)\r
+ */\r
+ public void setRowHeight(int row, int height){\r
+ int currentHeight = cells[row][0].getAnchor().height;\r
+ int dy = height - currentHeight;\r
+\r
+ for (int i = row; i < cells.length; i++) {\r
+ for (int j = 0; j < cells[i].length; j++) {\r
+ Rectangle anchor = cells[i][j].getAnchor();\r
+ if(i == row) anchor.height = height;\r
+ else anchor.y += dy;\r
+ cells[i][j].setAnchor(anchor);\r
+ }\r
+ }\r
+ Rectangle tblanchor = getAnchor();\r
+ tblanchor.height += dy;\r
+ setAnchor(tblanchor);\r
+\r
+ }\r
+\r
+ /**\r
+ * Sets the column width.\r
+ *\r
+ * @param col the column index (0-based)\r
+ * @param width the width to set (in pixels)\r
+ */\r
+ public void setColumnWidth(int col, int width){\r
+ int currentWidth = cells[0][col].getAnchor().width;\r
+ int dx = width - currentWidth;\r
+ for (int i = 0; i < cells.length; i++) {\r
+ Rectangle anchor = cells[i][col].getAnchor();\r
+ anchor.width = width;\r
+ cells[i][col].setAnchor(anchor);\r
+\r
+ if(col < cells[i].length - 1) for (int j = col+1; j < cells[i].length; j++) {\r
+ anchor = cells[i][j].getAnchor();\r
+ anchor.x += dx;\r
+ cells[i][j].setAnchor(anchor);\r
+ }\r
+ }\r
+ Rectangle tblanchor = getAnchor();\r
+ tblanchor.width += dx;\r
+ setAnchor(tblanchor);\r
+ }\r
+\r
+ /**\r
+ * Format the table and apply the specified Line to all cell boundaries,\r
+ * both outside and inside\r
+ *\r
+ * @param line the border line\r
+ */\r
+ public void setAllBorders(Line line){\r
+ for (int i = 0; i < cells.length; i++) {\r
+ for (int j = 0; j < cells[i].length; j++) {\r
+ TableCell cell = cells[i][j];\r
+ cell.setBorderTop(cloneBorder(line));\r
+ cell.setBorderLeft(cloneBorder(line));\r
+ if(j == cells[i].length - 1) cell.setBorderRight(cloneBorder(line));\r
+ if(i == cells.length - 1) cell.setBorderBottom(cloneBorder(line));\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Format the outside border using the specified Line object\r
+ *\r
+ * @param line the border line\r
+ */\r
+ public void setOutsideBorders(Line line){\r
+ for (int i = 0; i < cells.length; i++) {\r
+ for (int j = 0; j < cells[i].length; j++) {\r
+ TableCell cell = cells[i][j];\r
+\r
+ if(j == 0) cell.setBorderLeft(cloneBorder(line));\r
+ if(j == cells[i].length - 1) cell.setBorderRight(cloneBorder(line));\r
+ else {\r
+ cell.setBorderLeft(null);\r
+ cell.setBorderLeft(null);\r
+ }\r
+\r
+ if(i == 0) cell.setBorderTop(cloneBorder(line));\r
+ else if(i == cells.length - 1) cell.setBorderBottom(cloneBorder(line));\r
+ else {\r
+ cell.setBorderTop(null);\r
+ cell.setBorderBottom(null);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Format the inside border using the specified Line object\r
+ *\r
+ * @param line the border line\r
+ */\r
+ public void setInsideBorders(Line line){\r
+ for (int i = 0; i < cells.length; i++) {\r
+ for (int j = 0; j < cells[i].length; j++) {\r
+ TableCell cell = cells[i][j];\r
+\r
+ if(j != cells[i].length - 1)\r
+ cell.setBorderRight(cloneBorder(line));\r
+ else {\r
+ cell.setBorderLeft(null);\r
+ cell.setBorderLeft(null);\r
+ }\r
+ if(i != cells.length - 1) cell.setBorderBottom(cloneBorder(line));\r
+ else {\r
+ cell.setBorderTop(null);\r
+ cell.setBorderBottom(null);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ private Line cloneBorder(Line line){\r
+ Line border = createBorder();\r
+ border.setLineWidth(line.getLineWidth());\r
+ border.setLineStyle(line.getLineStyle());\r
+ border.setLineDashing(line.getLineDashing());\r
+ border.setLineColor(line.getLineColor());\r
+ return border;\r
+ }\r
+\r
+ /**\r
+ * Create a border to format this table\r
+ *\r
+ * @return the created border\r
+ */\r
+ public Line createBorder(){\r
+ Line line = new Line(this);\r
+\r
+ EscherOptRecord opt = (EscherOptRecord)getEscherChild(line.getSpContainer(), EscherOptRecord.RECORD_ID);\r
+ setEscherProperty(opt, EscherProperties.GEOMETRY__SHAPEPATH, -1);\r
+ setEscherProperty(opt, EscherProperties.GEOMETRY__FILLOK, -1);\r
+ setEscherProperty(opt, EscherProperties.SHADOWSTYLE__SHADOWOBSURED, 0x20000);\r
+ setEscherProperty(opt, EscherProperties.THREED__LIGHTFACE, 0x80000);\r
+\r
+ return line;\r
+ }\r
+}\r
--- /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
+package org.apache.poi.hslf.model;\r
+\r
+import org.apache.poi.ddf.*;\r
+import org.apache.poi.hslf.record.EscherTextboxWrapper;\r
+import org.apache.poi.hslf.record.TextHeaderAtom;\r
+import org.apache.poi.hslf.usermodel.RichTextRun;\r
+\r
+import java.awt.*;\r
+\r
+/**\r
+ * Represents a cell in a ppt table\r
+ * \r
+ * @author Yegor Kozlov\r
+ */\r
+public class TableCell extends TextBox {\r
+ protected static final int DEFAULT_WIDTH = 100;\r
+ protected static final int DEFAULT_HEIGHT = 40;\r
+\r
+ private Line borderLeft;\r
+ private Line borderRight;\r
+ private Line borderTop;\r
+ private Line borderBottom;\r
+\r
+ /**\r
+ * Create a TableCell object and initialize it from the supplied Record container.\r
+ *\r
+ * @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape\r
+ * @param parent the parent of the shape\r
+ */\r
+ protected TableCell(EscherContainerRecord escherRecord, Shape parent){\r
+ super(escherRecord, parent);\r
+ }\r
+\r
+ /**\r
+ * Create a new TableCell. This constructor is used when a new shape is created.\r
+ *\r
+ * @param parent the parent of this Shape. For example, if this text box is a cell\r
+ * in a table then the parent is Table.\r
+ */\r
+ public TableCell(Shape parent){\r
+ super(parent);\r
+\r
+ setShapeType(ShapeTypes.Rectangle);\r
+ _txtrun.setRunType(TextHeaderAtom.HALF_BODY_TYPE);\r
+ _txtrun.getRichTextRuns()[0].setFlag(false, 0, false);\r
+ }\r
+\r
+ protected EscherContainerRecord createSpContainer(boolean isChild){\r
+ EscherContainerRecord spContainer = super.createSpContainer(isChild);\r
+ EscherOptRecord opt = (EscherOptRecord)getEscherChild(spContainer, EscherOptRecord.RECORD_ID);\r
+ setEscherProperty(opt, EscherProperties.TEXT__TEXTID, 0);\r
+ setEscherProperty(opt, EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 0x20000);\r
+ setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150001);\r
+ setEscherProperty(opt, EscherProperties.SHADOWSTYLE__SHADOWOBSURED, 0x20000);\r
+ setEscherProperty(opt, EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x40000);\r
+\r
+ return spContainer;\r
+ }\r
+\r
+ protected void anchorBorder(int type, Line line){\r
+ Rectangle cellAnchor = getAnchor();\r
+ Rectangle lineAnchor = new Rectangle();\r
+ switch(type){\r
+ case Table.BORDER_TOP:\r
+ lineAnchor.x = cellAnchor.x;\r
+ lineAnchor.y = cellAnchor.y;\r
+ lineAnchor.width = cellAnchor.width;\r
+ lineAnchor.height = 0;\r
+ break;\r
+ case Table.BORDER_RIGHT:\r
+ lineAnchor.x = cellAnchor.x + cellAnchor.width;\r
+ lineAnchor.y = cellAnchor.y;\r
+ lineAnchor.width = 0;\r
+ lineAnchor.height = cellAnchor.height;\r
+ break;\r
+ case Table.BORDER_BOTTOM:\r
+ lineAnchor.x = cellAnchor.x;\r
+ lineAnchor.y = cellAnchor.y + cellAnchor.height;\r
+ lineAnchor.width = cellAnchor.width;\r
+ lineAnchor.height = 0;\r
+ break;\r
+ case Table.BORDER_LEFT:\r
+ lineAnchor.x = cellAnchor.x;\r
+ lineAnchor.y = cellAnchor.y;\r
+ lineAnchor.width = 0;\r
+ lineAnchor.height = cellAnchor.height;\r
+ break;\r
+ default:\r
+ throw new IllegalArgumentException("Unknown border type: " + type);\r
+ }\r
+ line.setAnchor(lineAnchor);\r
+ }\r
+\r
+ public Line getBorderLeft() {\r
+ return borderLeft;\r
+ }\r
+\r
+ public void setBorderLeft(Line line) {\r
+ if(line != null) anchorBorder(Table.BORDER_LEFT, line);\r
+ this.borderLeft = line;\r
+ }\r
+\r
+ public Line getBorderRight() {\r
+ return borderRight;\r
+ }\r
+\r
+ public void setBorderRight(Line line) {\r
+ if(line != null) anchorBorder(Table.BORDER_RIGHT, line);\r
+ this.borderRight = line;\r
+ }\r
+\r
+ public Line getBorderTop() {\r
+ return borderTop;\r
+ }\r
+\r
+ public void setBorderTop(Line line) {\r
+ if(line != null) anchorBorder(Table.BORDER_TOP, line);\r
+ this.borderTop = line;\r
+ }\r
+\r
+ public Line getBorderBottom() {\r
+ return borderBottom;\r
+ }\r
+\r
+ public void setBorderBottom(Line line) {\r
+ if(line != null) anchorBorder(Table.BORDER_BOTTOM, line);\r
+ this.borderBottom = line;\r
+ }\r
+\r
+ public void setAnchor(Rectangle anchor){\r
+ super.setAnchor(anchor);\r
+\r
+ if(borderTop != null) anchorBorder(Table.BORDER_TOP, borderTop);\r
+ if(borderRight != null) anchorBorder(Table.BORDER_RIGHT, borderRight);\r
+ if(borderBottom != null) anchorBorder(Table.BORDER_BOTTOM, borderBottom);\r
+ if(borderLeft != null) anchorBorder(Table.BORDER_LEFT, borderLeft);\r
+ }\r
+}\r
break;
}
}
- if(_txtrun == null) {
- logger.log(POILogger.WARN, "text run not found for shapeId=" + shapeId);
- }
}
}
setFlag(true, index, value);
}
- private void setFlag(boolean isCharacter, int index, boolean value) {
+ public void setFlag(boolean isCharacter, int index, boolean value) {
TextPropCollection props;
String propname;
if (isCharacter){
* @param propName The name of the Character TextProp
* @param val The value to set for the TextProp
*/
- private void setParaTextPropVal(String propName, int val) {
+ public void setParaTextPropVal(String propName, int val) {
// Ensure we have the StyleTextProp atom we're going to need
if(paragraphStyle == null) {
parentRun.ensureStyleAtomPresent();
* @param propName The name of the Paragraph TextProp
* @param val The value to set for the TextProp
*/
- private void setCharTextPropVal(String propName, int val) {
+ public void setCharTextPropVal(String propName, int val) {
// Ensure we have the StyleTextProp atom we're going to need
if(characterStyle == null) {
parentRun.ensureStyleAtomPresent();