本文整理汇总了Java中org.apache.poi.hssf.record.Record类的典型用法代码示例。如果您正苦于以下问题:Java Record类的具体用法?Java Record怎么用?Java Record使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Record类属于org.apache.poi.hssf.record包,在下文中一共展示了Record类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeObProjRecord
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
@Test
void removeObProjRecord() {
Record valid1 = new UnknownRecord(0x01, new byte[]{});
Record obProj1 = new UnknownRecord(0xD3, new byte[]{});
Record valid2 = new UnknownRecord(0x02, new byte[]{});
Collection<Record> records = new HashSet<>();
records.add(valid1);
records.add(obProj1);
records.add(valid2);
ExcelRecordCleaner.removeObProjRecord(records);
assertTrue(records.contains(valid1), "A valid record is not removed");
assertTrue(records.contains(valid2), "A valid record is not removed");
assertFalse(records.contains(obProj1), "The ObProj record is removed");
}
示例2: process
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
public void process(Record r) {
switch (r.getSid()) {
case MergeCellsRecord.sid:
mergeCellRecords.add((MergeCellsRecord) r);
break;
case SharedFormulaRecord.sid:
shFrmRecords.add((SharedFormulaRecord) r);
if (!(prevRec instanceof FormulaRecord)) {
throw new RuntimeException("Shared formula record should follow a FormulaRecord");
}
FormulaRecord fr = (FormulaRecord) prevRec;
firstCellRefs.add(new CellReference(fr.getRow(), fr.getColumn()));
break;
case ArrayRecord.sid:
arrayRecords.add((ArrayRecord) r);
break;
case TableRecord.sid:
tableRecords.add((TableRecord) r);
break;
default:
plainRecords.add(r);
break;
}
prevRec = r;
}
示例3: moveToStartOfSheet
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
/**
* moves right after the BOF record of the target sheet
*
* @param sheetIndex index of target sheet
*/
private void moveToStartOfSheet(int sheetIndex) {
int currentSheet = -1;
while(currentSheet < sheetIndex) {
final Record r = Preconditions.checkNotNull(recordStream.nextRecord(), "stream ended abruptly");
final short sid = r.getSid();
if (sid == BOFRecord.sid) { // start of a stream
BOFRecord bof = (BOFRecord) r;
if (bof.getType() != BOFRecord.TYPE_WORKSHEET) {
continue; // ignored stream
}
currentSheet++;
}
}
}
示例4: getValueAt
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
public Object getValueAt(int r, int c) {
Record record = records.get(r);
Object value = null;
switch(c) {
case 0:
value = record.getClass().getSimpleName();
break;
case 1:
value = record.getSid();
break;
case 2:
value = record.getRecordSize();
break;
}
return value;
}
示例5: addChildrenToParent
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
/**
* On encountering a BOF record this function needs to be called with a
* RecordTreeNode, which holds the current BOF Record and index of the BOF
* record from which we need to move forward till we either reach the end of
* Raw Records list or EOF.
*
* @param parentNode
* @param prevIndex
*/
private int addChildrenToParent(RecordTreeNode parentNode, int prevIndex) {
int lastIndex = prevIndex;
INNER: for (int index = prevIndex; index < rawRecords.size(); ++index) {
Record record = rawRecords.get(index);
RecordTreeNode childNode = new RecordTreeNode(record);
if (treeEndList.contains(record.getClass().getSimpleName())) {
lastIndex = index;
break INNER;
} else if (treeBeginList.contains(record.getClass().getSimpleName())) {
lastIndex = processChildTree(parentNode, childNode, index);
index = lastIndex;
}
parentNode.addChild(childNode);
}
return lastIndex;
}
示例6: recordFound
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
@Override
protected void recordFound(Record record) {
switch(record.getSid()) {
case BoundSheetRecord.sid:
sheets.add(((BoundSheetRecord)record).getSheetname());
break;
case NameRecord.sid:
NameRecord nr = (NameRecord) record;
if(isUserDefinedName(nr)) {
String name = nr.getNameText();
String formula = toFormulaString(nr.getNameDefinition());
if(formula != null) {
formula = formula.replaceAll(RELACE_WB_NAME, "");
names.put(name, formula);
}
}
default:
break;
}
}
示例7: loadRecords
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
private void loadRecords(final DefaultMutableTreeNode parentNode, final List<Record> records) {
for (final Record r : records) {
final DefaultMutableTreeNode rNode = new DefaultMutableTreeNode();
final HSSFEntry entry = appContext.getBean(HSSFEntry.class, r, rNode);
rNode.setUserObject(entry);
parentNode.add(rNode);
}
}
示例8: removeObProjRecord
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
protected static void removeObProjRecord(Collection<Record> records) {
new HashSet<>(records).forEach(record -> {
if (!isObProj(record)) {
return;
}
records.remove(record);
LOGGER.debug("Found and removed ObProj record: {}", record);
});
}
示例9: processRecord
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
/**
* Process this record ourselves, and then pass it on to our child listener
*/
public void processRecord(Record record) {
// Handle it ourselves
processRecordInternally(record);
// Now pass on to our child
_childListener.processRecord(record);
}
示例10: processRecordInternally
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
/**
* Process the record ourselves, but do not pass it on to the child
* Listener.
*
* @param record
*/
public void processRecordInternally(Record record) {
if (record instanceof FormatRecord) {
FormatRecord fr = (FormatRecord) record;
_customFormatRecords.put(Integer.valueOf(fr.getIndexCode()), fr);
}
if (record instanceof ExtendedFormatRecord) {
ExtendedFormatRecord xr = (ExtendedFormatRecord) record;
_xfRecords.add(xr);
}
}
示例11: processRecord
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
/**
* Cabe�ote de leitura do LeitorXLSCliente. Implementa��o do m�todo
* processRecord da interface HSSFListener do POI {@link HSSFListener}.
* <BR><BR>
* A implementa��o de leitura de XLS do POI HSSF faz a leitura linear dos
* dados do arquivo, acionando o m�todo processRecord a cada registro
* encontrado. T�cnica semelhante � leitura de um XML por SAX.
* <BR><BR>
* @param record elemento do Arquivo excel que est� sendo lido no momento.
*/
public void processRecord(Record record) {
this.xlsRecordAtual = record;
System.out.println(record);
if(isPermiteLerLinhaColuna()){
atualizaControlePosicaoAtual();
if (isEnviarMensagemJMS() && criadoNovoRegistro) {
enviarMensagemJMS();
criarNovoRegistro();
this.criadoNovoRegistro = false;
}
if (isCriarNovoRegistro() && !criadoNovoRegistro) {
this.criadoNovoRegistro = true;
}
if (isLerValorDoRecord()) {
popularRegistroAtual();
}
}else{
if(isFinalDeArquivo()){
//envia �ltimo registro lido que sobrou no final do processamento
enviarMensagemJMS();
}
}
if (record.getSid()==SSTRecord.sid){
sstrec = (SSTRecord) record;
}
}
示例12: processRecord
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
/**
* Cabe�ote de leitura do LeitorXLSCliente. Implementa��o do m�todo
* processRecord da interface HSSFListener do POI {@link HSSFListener}.
* <BR><BR>
* A implementa��o de leitura de XLS do POI HSSF faz a leitura linear dos
* dados do arquivo, acionando o m�todo processRecord a cada registro
* encontrado. T�cnica semelhante � leitura de um XML por SAX.
* <BR><BR>
* @param record elemento do Arquivo excel que est� sendo lido no momento.
*/
public void processRecord(Record record) {
this.xlsRecordAtual = record;
if(isPermiteLerLinhaColuna()){
atualizaControlePosicaoAtual();
if (isEnviarMensagemJMS() && criadoNovoRegistro) {
enviarMensagemJMS();
criarNovoRegistro();
this.leuPrimeiraLinha = true;
this.criadoNovoRegistro = false;
}
/*
if (isCriarNovoRegistro() && !criadoNovoRegistro) {
this.criadoNovoRegistro = true;
}
if (isLerValorDoRecord()) {
popularRegistroAtual();
}
*/
}
if (record.getSid()==SSTRecord.sid){
sstrec = (SSTRecord) record;
}
}
示例13: processRecord
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
/**
* Cabe�ote de leitura do LeitorXLSCliente. Implementa��o do m�todo
* processRecord da interface HSSFListener do POI {@link HSSFListener}.
* <BR><BR>
* A implementa��o de leitura de XLS do POI HSSF faz a leitura linear dos
* dados do arquivo, acionando o m�todo processRecord a cada registro
* encontrado. T�cnica semelhante � leitura de um XML por SAX.
* <BR><BR>
* @param record elemento do Arquivo excel que est� sendo lido no momento.
*/
public void processRecord(Record record) {
this.xlsRecordAtual = record;
if(isPermiteLerLinhaColuna()){
atualizaControlePosicaoAtual();
if (isEnviarMensagemJMS() && criadoNovoRegistro) {
enviarMensagemJMS();
criarNovoRegistro();
this.criadoNovoRegistro = false;
}
if (isCriarNovoRegistro() && !criadoNovoRegistro) {
this.criadoNovoRegistro = true;
}
if (isLerValorDoRecord()) {
popularRegistroAtual();
}
}else{
if(isFinalDeArquivo()){
//envia �ltimo registro lido que sobrou no final do processamento
enviarMensagemJMS();
}
}
if (record.getSid()==SSTRecord.sid){
sstrec = (SSTRecord) record;
}
}
示例14: RecordTreeTableModel
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
public RecordTreeTableModel(List<Record> rawRecords) {
this.rawRecords = rawRecords;
rootNode = new RecordTreeNode();
for (int index = 0; index < rawRecords.size(); ++index) {
Record record = rawRecords.get(index);
RecordTreeNode childNode = new RecordTreeNode(record);
if (record.getClass().getSimpleName().equals("BOFRecord")) {
int lastIndex = processChildTree(rootNode, childNode, index);
index = lastIndex;
} else {
rootNode.addChild(childNode);
}
}
}
示例15: getRecordName
import org.apache.poi.hssf.record.Record; //导入依赖的package包/类
public String getRecordName(Record record) {
String value = null;
String simpleName = record.getClass().getSimpleName();
String baseName = simpleName.substring(0, simpleName.length() - 6);
if (baseName.equals("Unknown")) {
String description = record.toString();
value = description.substring(1, description.indexOf(']'));
} else {
value = baseName;
}
return value;
}