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/image/ImageHeaderWMF.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.image;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.Units;
/**
* Aldus Placeable Metafile header - 22 byte structure before WMF data.
* <ul>
* <li>int Key; Magic number (always 9AC6CDD7h)
* <li>short Handle; Metafile HANDLE number (always 0)
* <li>short Left; Left coordinate in metafile units
* <li>short Top; Top coordinate in metafile units
* <li>short Right; Right coordinate in metafile units
* <li>short Bottom; Bottom coordinate in metafile units
* <li>short Inch; Number of metafile units per inch
* <li>int Reserved; Reserved (always 0)
* <li>short Checksum; Checksum value for previous 10 shorts
* </ul>
*/
@Internal
public class ImageHeaderWMF {
public static final int APMHEADER_KEY = 0x9AC6CDD7;
private static final Logger LOG = LogManager.getLogger(ImageHeaderWMF.class);
@SuppressWarnings("unused")
private final int handle;
private final int left, top, right, bottom;
/**
* The number of logical units per inch used to represent the image.
* This value can be used to scale an image. By convention, an image is
* considered to be recorded at 1440 logical units (twips) per inch.
* Thus, a value of 720 specifies that the image SHOULD be rendered at
* twice its normal size, and a value of 2880 specifies that the image
* SHOULD be rendered at half its normal size.
*/
private final int inch;
@SuppressWarnings("unused")
private final int reserved;
private int checksum;
public ImageHeaderWMF(Rectangle dim) {
handle = 0;
left = dim.x;
top = dim.y;
right = dim.x + dim.width;
bottom = dim.y + dim.height;
inch = Units.POINT_DPI; //default resolution is 72 dpi
reserved = 0;
}
public ImageHeaderWMF(byte[] data, final int off) {
int offset = off;
int key = LittleEndian.getInt(data, offset); offset += LittleEndianConsts.INT_SIZE; //header key
if (key != APMHEADER_KEY) {
LOG.atWarn().log("WMF file doesn't contain a placeable header - ignore parsing");
handle = 0;
left = 0;
top = 0;
right = 200;
bottom = 200;
inch = Units.POINT_DPI; //default resolution is 72 dpi
reserved = 0;
return;
}
handle = LittleEndian.getUShort(data, offset); offset += LittleEndianConsts.SHORT_SIZE;
left = LittleEndian.getShort(data, offset); offset += LittleEndianConsts.SHORT_SIZE;
top = LittleEndian.getShort(data, offset); offset += LittleEndianConsts.SHORT_SIZE;
right = LittleEndian.getShort(data, offset); offset += LittleEndianConsts.SHORT_SIZE;
bottom = LittleEndian.getShort(data, offset); offset += LittleEndianConsts.SHORT_SIZE;
inch = LittleEndian.getUShort(data, offset); offset += LittleEndianConsts.SHORT_SIZE;
reserved = LittleEndian.getInt(data, offset); offset += LittleEndianConsts.INT_SIZE;
checksum = LittleEndian.getShort(data, offset); offset += LittleEndianConsts.SHORT_SIZE;
if (checksum != getChecksum()){
LOG.atWarn().log("WMF checksum does not match the header data");
}
}
/**
* Returns a checksum value for the previous 10 shorts in the header.
* The checksum is calculated by XORing each short value to an initial value of 0:
*/
public int getChecksum(){
int cs = 0;
cs ^= (APMHEADER_KEY & 0x0000FFFF);
cs ^= ((APMHEADER_KEY & 0xFFFF0000) >> 16);
cs ^= left;
cs ^= top;
cs ^= right;
cs ^= bottom;
cs ^= inch;
return cs;
}
public void write(OutputStream out) throws IOException {
byte[] header = new byte[22];
int pos = 0;
LittleEndian.putInt(header, pos, APMHEADER_KEY); pos += LittleEndianConsts.INT_SIZE; //header key
LittleEndian.putUShort(header, pos, 0); pos += LittleEndianConsts.SHORT_SIZE; //hmf
LittleEndian.putUShort(header, pos, left); pos += LittleEndianConsts.SHORT_SIZE; //left
LittleEndian.putUShort(header, pos, top); pos += LittleEndianConsts.SHORT_SIZE; //top
LittleEndian.putUShort(header, pos, right); pos += LittleEndianConsts.SHORT_SIZE; //right
LittleEndian.putUShort(header, pos, bottom); pos += LittleEndianConsts.SHORT_SIZE; //bottom
LittleEndian.putUShort(header, pos, inch); pos += LittleEndianConsts.SHORT_SIZE; //inch
LittleEndian.putInt(header, pos, 0); pos += LittleEndianConsts.INT_SIZE; //reserved
checksum = getChecksum();
LittleEndian.putUShort(header, pos, checksum);
out.write(header);
}
public Dimension getSize() {
//coefficient to translate from WMF dpi to 72dpi
double coeff = ((double)Units.POINT_DPI)/inch;
return new Dimension((int)Math.round((right-left)*coeff), (int)Math.round((bottom-top)*coeff));
}
public Rectangle getBounds() {
return new Rectangle(left, top, right-left, bottom-top);
}
public int getLength(){
return 22;
}
}
⏎ org/apache/poi/sl/image/ImageHeaderWMF.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, ≈311🔥, 0💬
Popular Posts:
JDK 6 tools.jar is the JAR file for JDK 6 tools. It contains Java classes to support different JDK t...
Where to get the Java source code for Connector/J 8.0 Protocol Impl module? Java source code files f...
maven-model-builder-3.8. 6.jaris the JAR file for Apache Maven 3.8.6 Model Builder module. Apache Ma...
JDK 11 jdk.crypto.mscapi.jmod is the JMOD file for JDK 11 Crypto MSCAPI module. JDK 11 Crypto MSCAPI...
maven-embedder-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Embedder module. Apache Maven is a s...