Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
What Is poi-5.2.3.jar?
What Is poi-5.2.3.jar?
✍: FYIcenter.com
poi-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which
provides an API for Microsoft document files of Word, Excel, PowerPoint, and Visio.
poi-5.2.3.jar supports Apache POI components that read and write Microsoft's OLE 2 Compound document format, which is used in early versions of Microsoft Office tools like Word 97, Excel 97, PowerPoint 97, etc.
poi-5.2.3.jar is distributed as part of the poi-bin-5.2.3-20220909.zip download file.
JAR File Size and Download Location:
JAR name: poi-5.2.3.jar Target JDK version: 9 File name: poi.jar, poi-5.2.3.jar File size: 2964641 bytes Release date: 09-09-2022 Download: Apache POI Website
Here are Java Source Code files for poi-5.2.3.jar:
⏎ org/apache/poi/sl/draw/DrawTableShape.java
/* ====================================================================
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.sl.draw;
import static org.apache.poi.sl.draw.DrawPaint.fillPaintWorkaround;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;
import org.apache.poi.sl.usermodel.GroupShape;
import org.apache.poi.sl.usermodel.StrokeStyle;
import org.apache.poi.sl.usermodel.StrokeStyle.LineCompound;
import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
import org.apache.poi.sl.usermodel.TableCell;
import org.apache.poi.sl.usermodel.TableCell.BorderEdge;
import org.apache.poi.util.Internal;
import org.apache.poi.sl.usermodel.TableShape;
public class DrawTableShape extends DrawShape {
/**
* Additional spacing between cells
*/
@Internal
public static final int borderSize = 2;
public DrawTableShape(TableShape<?,?> shape) {
super(shape);
}
protected Drawable getGroupShape(Graphics2D graphics) {
if (shape instanceof GroupShape) {
DrawFactory df = DrawFactory.getInstance(graphics);
return df.getDrawable((GroupShape<?,?>)shape);
}
return null;
}
public void applyTransform(Graphics2D graphics) {
Drawable d = getGroupShape(graphics);
if (d != null) {
d.applyTransform(graphics);
} else {
super.applyTransform(graphics);
}
}
public void draw(Graphics2D graphics) {
Drawable d = getGroupShape(graphics);
if (d != null) {
d.draw(graphics);
return;
}
TableShape<?,?> ts = getShape();
DrawPaint drawPaint = DrawFactory.getInstance(graphics).getPaint(ts);
final int rows = ts.getNumberOfRows();
final int cols = ts.getNumberOfColumns();
// draw background boxes
for (int row=0; row<rows; row++) {
for (int col=0; col<cols; col++) {
TableCell<?,?> tc = ts.getCell(row, col);
if (tc == null || tc.isMerged()) {
continue;
}
Paint fillPaint = drawPaint.getPaint(graphics, tc.getFillStyle().getPaint());
graphics.setPaint(fillPaint);
Rectangle2D cellAnc = tc.getAnchor();
fillPaintWorkaround(graphics, cellAnc);
for (BorderEdge edge : BorderEdge.values()) {
StrokeStyle stroke = tc.getBorderStyle(edge);
if (stroke == null) {
continue;
}
graphics.setStroke(getStroke(stroke));
Paint linePaint = drawPaint.getPaint(graphics, stroke.getPaint());
graphics.setPaint(linePaint);
double x=cellAnc.getX(), y=cellAnc.getY(), w=cellAnc.getWidth(), h=cellAnc.getHeight();
Line2D line;
switch (edge) {
default:
case bottom:
line = new Line2D.Double(x-borderSize, y+h, x+w+borderSize, y+h);
break;
case left:
line = new Line2D.Double(x, y, x, y+h+borderSize);
break;
case right:
line = new Line2D.Double(x+w, y, x+w, y+h+borderSize);
break;
case top:
line = new Line2D.Double(x-borderSize, y, x+w+borderSize, y);
break;
}
graphics.draw(line);
}
}
}
// draw text
drawContent(graphics);
}
public void drawContent(Graphics2D graphics) {
Drawable d = getGroupShape(graphics);
if (d != null) {
d.drawContent(graphics);
return;
}
TableShape<?,?> ts = getShape();
DrawFactory df = DrawFactory.getInstance(graphics);
final int rows = ts.getNumberOfRows();
final int cols = ts.getNumberOfColumns();
for (int row=0; row<rows; row++) {
for (int col=0; col<cols; col++) {
TableCell<?,?> tc = ts.getCell(row, col);
if (tc != null) {
DrawTextShape dts = df.getDrawable(tc);
dts.drawContent(graphics);
}
}
}
}
@Override
protected TableShape<?,?> getShape() {
return (TableShape<?,?>)shape;
}
/**
* Format the table and apply the specified Line to all cell boundaries,
* both outside and inside.
* An empty args parameter removes the affected border.
*
* @param args a varargs array possible containing {@link Double} (width),
* {@link LineCompound}, {@link Color}, {@link LineDash}
*/
public void setAllBorders(Object... args) {
TableShape<?,?> table = getShape();
final int rows = table.getNumberOfRows();
final int cols = table.getNumberOfColumns();
BorderEdge[] edges = {BorderEdge.top, BorderEdge.left, null, null};
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
edges[2] = (col == cols - 1) ? BorderEdge.right : null;
edges[3] = (row == rows - 1) ? BorderEdge.bottom : null;
setEdges(table.getCell(row, col), edges, args);
}
}
}
/**
* Format the outside border using the specified Line object
* An empty args parameter removes the affected border.
*
* @param args a varargs array possible containing {@link Double} (width),
* {@link LineCompound}, {@link Color}, {@link LineDash}
*/
public void setOutsideBorders(Object... args){
if (args.length == 0) return;
TableShape<?,?> table = getShape();
final int rows = table.getNumberOfRows();
final int cols = table.getNumberOfColumns();
BorderEdge[] edges = new BorderEdge[4];
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
edges[0] = (col == 0) ? BorderEdge.left : null;
edges[1] = (col == cols - 1) ? BorderEdge.right : null;
edges[2] = (row == 0) ? BorderEdge.top : null;
edges[3] = (row == rows - 1) ? BorderEdge.bottom : null;
setEdges(table.getCell(row, col), edges, args);
}
}
}
/**
* Format the inside border using the specified Line object
* An empty args parameter removes the affected border.
*
* @param args a varargs array possible containing {@link Double} (width),
* {@link LineCompound}, {@link Color}, {@link LineDash}
*/
public void setInsideBorders(Object... args) {
if (args.length == 0) return;
TableShape<?,?> table = getShape();
final int rows = table.getNumberOfRows();
final int cols = table.getNumberOfColumns();
BorderEdge[] edges = new BorderEdge[2];
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
edges[0] = (col > 0 && col < cols - 1) ? BorderEdge.right : null;
edges[1] = (row > 0 && row < rows - 1) ? BorderEdge.bottom : null;
setEdges(table.getCell(row, col), edges, args);
}
}
}
/**
* Apply the border attributes (args) to the given cell and edges
*
* @param cell the cell
* @param edges the border edges
* @param args the border attributes
*/
private static void setEdges(TableCell<?,?> cell, BorderEdge[] edges, Object... args) {
if (cell == null) {
return;
}
for (BorderEdge be : edges) {
if (be != null) {
if (args.length == 0) {
cell.removeBorder(be);
} else {
for (Object o : args) {
if (o instanceof Double) {
cell.setBorderWidth(be, (Double)o);
} else if (o instanceof Color) {
cell.setBorderColor(be, (Color)o);
} else if (o instanceof LineDash) {
cell.setBorderDash(be, (LineDash)o);
} else if (o instanceof LineCompound) {
cell.setBorderCompound(be, (LineCompound)o);
}
}
}
}
}
}
}
⏎ org/apache/poi/sl/draw/DrawTableShape.java
Or download all of them as a single archive file:
File name: poi-5.2.3-src.zip File size: 2479830 bytes Release date: 2022-09-09 Download
⇒ What Is poi-ooxml-5.2.3.jar?
⇐ What Is poi-bin-5.2.3-20220909.zip?
2017-04-04, ≈326🔥, 0💬
Popular Posts:
What is the jaxp\TypeInfoWriter.java provided in the Apache Xerces package? I have Apache Xerces 2.1...
JDK 11 jdk.jconsole.jmod is the JMOD file for JDK 11 JConsole tool, which can be invoked by the "jco...
JDK 11 jdk.rmic.jmod is the JMOD file for JDK 11 RMI (Remote Method Invocation) Compiler Tool tool, ...
How to download and install JDK (Java Development Kit) 6? If you want to write Java applications, yo...
Apache Commons CLI Source Code Files are provided in the source package file commons-cli-1.5.0-sourc. ..