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-scratchpad-5.2.3.jar?
What Is poi-scratchpad-5.2.3.jar?
✍: FYIcenter.com
poi-scratchpad-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-scratchpad-5.2.3.jar provides support for older versions of Microsoft document files like Word 97, Excel 97, PowerPoint 97, etc.
poi-scratchpad-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-scratchpad-5.2.3.jar Target JDK version: 9 Dependency: poi.jar File name: poi-scratchpad.jar, poi-scratchpad-5.2.3.jar File size: 1897121 bytes Release date: 09-09-2022 Download: Apache POI Website
Here are Java Source Code files for poi-scratchpad-5.2.3.jar:
⏎ org/apache/poi/hwpf/sprm/TableSprmUncompressor.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.hwpf.sprm;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.hwpf.usermodel.BorderCode;
import org.apache.poi.hwpf.usermodel.TableCellDescriptor;
import org.apache.poi.hwpf.usermodel.TableProperties;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
@Internal
public final class TableSprmUncompressor extends SprmUncompressor {
private static final Logger LOG = LogManager.getLogger(TableSprmUncompressor.class);
public TableSprmUncompressor()
{
}
public static TableProperties uncompressTAP( SprmBuffer sprmBuffer )
{
TableProperties tableProperties;
SprmOperation sprmOperation = sprmBuffer.findSprm( (short) 0xd608 );
if ( sprmOperation != null )
{
byte[] grpprl = sprmOperation.getGrpprl();
int offset = sprmOperation.getGrpprlOffset();
short itcMac = grpprl[offset];
tableProperties = new TableProperties( itcMac );
}
else
{
LOG.atWarn().log("Some table rows didn't specify number of columns in SPRMs");
tableProperties = new TableProperties( (short) 1 );
}
for ( SprmIterator iterator = sprmBuffer.iterator(); iterator.hasNext(); )
{
SprmOperation sprm = iterator.next();
/*
* TAPXs are actually PAPXs so we have to make sure we are only
* trying to uncompress the right type of sprm.
*/
if ( sprm.getType() == SprmOperation.TYPE_TAP )
{
try
{
unCompressTAPOperation( tableProperties, sprm );
}
catch ( ArrayIndexOutOfBoundsException ex )
{
LOG.atError().withThrowable(ex).log("Unable to apply {}", sprm);
}
}
}
return tableProperties;
}
/**
* Used to uncompress a table property. Performs an operation defined
* by a sprm stored in a tapx.
*
* @param newTAP The TableProperties object to perform the operation on.
* @param sprm The operation to perform.
*/
static void unCompressTAPOperation (TableProperties newTAP, SprmOperation sprm)
{
switch (sprm.getOperation())
{
case 0:
newTAP.setJc ((short) sprm.getOperand());
break;
case 0x01:
{
short[] rgdxaCenter = newTAP.getRgdxaCenter ();
short itcMac = newTAP.getItcMac ();
int adjust = sprm.getOperand() - (rgdxaCenter[0] + newTAP.getDxaGapHalf ());
for (int x = 0; x < itcMac; x++)
{
rgdxaCenter[x] += (short) adjust;
}
break;
}
case 0x02:
{
short[] rgdxaCenter = newTAP.getRgdxaCenter ();
if (rgdxaCenter != null)
{
int adjust = newTAP.getDxaGapHalf () - sprm.getOperand();
rgdxaCenter[0] += (short) adjust;
}
newTAP.setDxaGapHalf (sprm.getOperand());
break;
}
case 0x03:
newTAP.setFCantSplit (getFlag(sprm.getOperand()));
break;
case 0x04:
newTAP.setFTableHeader (getFlag (sprm.getOperand()));
break;
case 0x05:
{
byte[] buf = sprm.getGrpprl();
int offset = sprm.getGrpprlOffset();
newTAP.setBrcTop(new BorderCode(buf, offset));
offset += BorderCode.SIZE;
newTAP.setBrcLeft(new BorderCode(buf, offset));
offset += BorderCode.SIZE;
newTAP.setBrcBottom(new BorderCode(buf, offset));
offset += BorderCode.SIZE;
newTAP.setBrcRight(new BorderCode(buf, offset));
offset += BorderCode.SIZE;
newTAP.setBrcHorizontal(new BorderCode(buf, offset));
offset += BorderCode.SIZE;
newTAP.setBrcVertical(new BorderCode(buf, offset));
break;
}
case 0x06:
//obsolete, used in word 1.x
break;
case 0x07:
newTAP.setDyaRowHeight (sprm.getOperand());
break;
case 0x08:
{
byte[] grpprl = sprm.getGrpprl();
int offset = sprm.getGrpprlOffset();
short itcMac = grpprl[offset];
short[] rgdxaCenter = new short[itcMac + 1];
TableCellDescriptor[] rgtc = new TableCellDescriptor[itcMac];
//I use varParam[0] and newTAP._itcMac interchangably
newTAP.setItcMac (itcMac);
newTAP.setRgdxaCenter (rgdxaCenter);
newTAP.setRgtc (rgtc);
// get the rgdxaCenters
for (int x = 0; x < itcMac; x++)
{
rgdxaCenter[x] = LittleEndian.getShort (grpprl, offset + (1 + (x * 2)));
}
// only try to get the TC entries if they exist...
int endOfSprm = offset+sprm.size()-6; // -2 bytes for sprm - 2 for size short - 2 to correct offsets being 0 based
int startOfTCs = offset + (1 + (itcMac + 1) * 2);
boolean hasTCs = startOfTCs < endOfSprm;
for (int x = 0; x < itcMac; x++)
{
// Sometimes, the grpprl does not contain data at every offset. I have no idea why this happens.
if(hasTCs && offset + (1 + ( (itcMac + 1) * 2) + (x * 20)) < grpprl.length)
rgtc[x] = TableCellDescriptor.convertBytesToTC(grpprl,
offset + (1 + ( (itcMac + 1) * 2) + (x * 20)));
else
rgtc[x] = new TableCellDescriptor();
}
rgdxaCenter[itcMac] = LittleEndian.getShort (grpprl, offset + (1 + (itcMac * 2)));
break;
}
case 0x09:
/** @todo handle cell shading*/
break;
case 0x0a:
/** @todo handle word defined table styles*/
break;
case 0x20:
// {
// TableCellDescriptor[] rgtc = newTAP.getRgtc();
//
// for (int x = varParam[0]; x < varParam[1]; x++)
// {
//
// if ((varParam[2] & 0x08) > 0)
// {
// short[] brcRight = rgtc[x].getBrcRight ();
// brcRight[0] = LittleEndian.getShort (varParam, 6);
// brcRight[1] = LittleEndian.getShort (varParam, 8);
// }
// else if ((varParam[2] & 0x04) > 0)
// {
// short[] brcBottom = rgtc[x].getBrcBottom ();
// brcBottom[0] = LittleEndian.getShort (varParam, 6);
// brcBottom[1] = LittleEndian.getShort (varParam, 8);
// }
// else if ((varParam[2] & 0x02) > 0)
// {
// short[] brcLeft = rgtc[x].getBrcLeft ();
// brcLeft[0] = LittleEndian.getShort (varParam, 6);
// brcLeft[1] = LittleEndian.getShort (varParam, 8);
// }
// else if ((varParam[2] & 0x01) > 0)
// {
// short[] brcTop = rgtc[x].getBrcTop ();
// brcTop[0] = LittleEndian.getShort (varParam, 6);
// brcTop[1] = LittleEndian.getShort (varParam, 8);
// }
// }
// break;
// }
break;
case 0x21:
{
int param = sprm.getOperand();
int index = (param & 0xff000000) >> 24;
int count = (param & 0x00ff0000) >> 16;
int width = (param & 0x0000ffff);
int itcMac = newTAP.getItcMac();
short[] rgdxaCenter = new short[itcMac + count + 1];
TableCellDescriptor[] rgtc = new TableCellDescriptor[itcMac + count];
if (index >= itcMac)
{
index = itcMac;
System.arraycopy(newTAP.getRgdxaCenter(), 0, rgdxaCenter, 0,
itcMac + 1);
System.arraycopy(newTAP.getRgtc(), 0, rgtc, 0, itcMac);
}
else
{
//copy rgdxaCenter
System.arraycopy(newTAP.getRgdxaCenter(), 0, rgdxaCenter, 0,
index + 1);
System.arraycopy(newTAP.getRgdxaCenter(), index + 1, rgdxaCenter,
index + count, itcMac - (index));
//copy rgtc
System.arraycopy(newTAP.getRgtc(), 0, rgtc, 0, index);
System.arraycopy(newTAP.getRgtc(), index, rgtc, index + count,
itcMac - index);
}
for (int x = index; x < index + count; x++)
{
rgtc[x] = new TableCellDescriptor();
rgdxaCenter[x] = (short)(rgdxaCenter[x - 1] + width);
}
rgdxaCenter[index +
count] = (short)(rgdxaCenter[(index + count) - 1] + width);
break;
}
/**@todo handle table sprms from complex files*/
case 0x22:
case 0x23:
case 0x24:
case 0x25:
case 0x26:
case 0x27:
case 0x28:
case 0x29:
case 0x2a:
case 0x2b:
case 0x2c:
break;
case 0x34:
// sprmTCellPaddingDefault -- (0xd634)
// TODO: extract into CSSA structure
byte itcFirst = sprm.getGrpprl()[sprm.getGrpprlOffset()];
byte itcLim = sprm.getGrpprl()[sprm.getGrpprlOffset() + 1];
byte grfbrc = sprm.getGrpprl()[sprm.getGrpprlOffset() + 2];
byte ftsWidth = sprm.getGrpprl()[sprm.getGrpprlOffset() + 3];
short wWidth = LittleEndian.getShort(sprm.getGrpprl(),
sprm.getGrpprlOffset() + 4);
for (int c = itcFirst; c < itcLim; c++) {
TableCellDescriptor tableCellDescriptor = newTAP.getRgtc()[c];
if ((grfbrc & 0x01) != 0) {
tableCellDescriptor.setFtsCellPaddingTop(ftsWidth);
tableCellDescriptor.setWCellPaddingTop(wWidth);
}
if ((grfbrc & 0x02) != 0) {
tableCellDescriptor.setFtsCellPaddingLeft(ftsWidth);
tableCellDescriptor.setWCellPaddingLeft(wWidth);
}
if ((grfbrc & 0x04) != 0) {
tableCellDescriptor.setFtsCellPaddingBottom(ftsWidth);
tableCellDescriptor.setWCellPaddingBottom(wWidth);
}
if ((grfbrc & 0x08) != 0) {
tableCellDescriptor.setFtsCellPaddingRight(ftsWidth);
tableCellDescriptor.setWCellPaddingRight(wWidth);
}
}
break;
default:
break;
}
}
}
⏎ org/apache/poi/hwpf/sprm/TableSprmUncompressor.java
Or download all of them as a single archive file:
File name: poi-scratchpad-5.2.3-src.zip File size: 1238744 bytes Release date: 2022-09-09 Download
⇒ What Is poi-examples-5.2.3.jar?
⇐ What Is poi-excelant-5.2.3.jar?
2017-03-22, ≈140🔥, 0💬
Popular Posts:
commons-lang-2.6.jar is the JAR file for Apache Commons Lang 2.6, which provides a host of helper ut...
JAX-RPC is an API for building Web services and clients that used remote procedure calls (RPC) and X...
Java Cryptography Extension 1.6 JAR File Size and Download Location: File name: jce.jar, jce-1.6.jar...
What is the jaxp\TypeInfoWriter.java provided in the Apache Xerces package? I have Apache Xerces 2.1...
JDK 11 jdk.scripting.nashorn.jm odis the JMOD file for JDK 11 Scripting Nashorn module. JDK 11 Scrip...