📄 workbookparser.java
字号:
formattingRecords.setPalette(palette);
} else
if(r.getType() == Type.NINETEENFOUR)
{
NineteenFourRecord nr = new NineteenFourRecord(r);
nineteenFour = nr.is1904();
} else
if(r.getType() == Type.FORMAT)
{
FormatRecord fr = null;
if(bof.isBiff8())
fr = new FormatRecord(r, settings, FormatRecord.biff8);
else
fr = new FormatRecord(r, settings, FormatRecord.biff7);
try
{
formattingRecords.addFormat(fr);
}
catch(NumFormatRecordsException e)
{
e.printStackTrace();
Assert.verify(false, e.getMessage());
}
} else
if(r.getType() == Type.XF)
{
XFRecord xfr = null;
if(bof.isBiff8())
xfr = new XFRecord(r, settings, XFRecord.biff8);
else
xfr = new XFRecord(r, settings, XFRecord.biff7);
try
{
formattingRecords.addStyle(xfr);
}
catch(NumFormatRecordsException e)
{
Assert.verify(false, e.getMessage());
}
} else
if(r.getType() == Type.BOUNDSHEET)
{
BoundsheetRecord br = null;
if(bof.isBiff8())
br = new BoundsheetRecord(r);
else
br = new BoundsheetRecord(r, BoundsheetRecord.biff7);
if(br.isSheet())
boundsheets.add(br);
else
if(br.isChart() && !settings.getDrawingsDisabled())
boundsheets.add(br);
} else
if(r.getType() == Type.EXTERNSHEET)
{
if(bof.isBiff8())
externSheet = new ExternalSheetRecord(r, settings);
else
externSheet = new ExternalSheetRecord(r, settings, ExternalSheetRecord.biff7);
} else
if(r.getType() == Type.CODEPAGE)
{
CodepageRecord cr = new CodepageRecord(r);
settings.setCharacterSet(cr.getCharacterSet());
} else
if(r.getType() == Type.SUPBOOK)
{
for(Record nextrec = excelFile.peek(); nextrec.getType() == Type.CONTINUE; nextrec = excelFile.peek())
r.addContinueRecord(excelFile.next());
SupbookRecord sr = new SupbookRecord(r, settings);
supbooks.add(sr);
} else
if(r.getType() == Type.EXTERNNAME)
{
ExternalNameRecord enr = new ExternalNameRecord(r, settings);
if(enr.isAddInFunction())
addInFunctions.add(enr.getName());
} else
if(r.getType() == Type.PROTECT)
{
ProtectRecord pr = new ProtectRecord(r);
wbProtected = pr.isProtected();
} else
if(r.getType() == Type.OBJPROJ)
containsMacros = true;
else
if(r.getType() == Type.COUNTRY)
countryRecord = new CountryRecord(r);
else
if(r.getType() == Type.MSODRAWINGGROUP)
{
if(!settings.getDrawingsDisabled())
{
msoDrawingGroup = new MsoDrawingGroupRecord(r);
if(drawingGroup == null)
drawingGroup = new DrawingGroup(Origin.READ);
drawingGroup.add(msoDrawingGroup);
Record nextrec = excelFile.peek();
while(nextrec.getType() == Type.CONTINUE)
{
drawingGroup.add(excelFile.next());
nextrec = excelFile.peek();
}
}
} else
if(r.getType() == Type.BUTTONPROPERTYSET)
buttonPropertySet = new ButtonPropertySetRecord(r);
else
if(r.getType() == Type.EOF)
bofs--;
}
} while(true);
bof = null;
if(excelFile.hasNext())
{
r = excelFile.next();
if(r.getType() == Type.BOF)
bof = new BOFRecord(r);
}
do
{
if(bof == null || getNumberOfSheets() >= boundsheets.size())
break;
if(!bof.isBiff8() && !bof.isBiff7())
throw new BiffException(BiffException.unrecognizedBiffVersion);
if(bof.isWorksheet())
{
SheetImpl s = new SheetImpl(excelFile, sharedStrings, formattingRecords, bof, workbookBof, nineteenFour, this);
BoundsheetRecord br = (BoundsheetRecord)boundsheets.get(getNumberOfSheets());
s.setName(br.getName());
s.setHidden(br.isHidden());
addSheet(s);
} else
if(bof.isChart())
{
SheetImpl s = new SheetImpl(excelFile, sharedStrings, formattingRecords, bof, workbookBof, nineteenFour, this);
BoundsheetRecord br = (BoundsheetRecord)boundsheets.get(getNumberOfSheets());
s.setName(br.getName());
s.setHidden(br.isHidden());
addSheet(s);
} else
{
logger.warn("BOF is unrecognized");
for(; excelFile.hasNext() && r.getType() != Type.EOF; r = excelFile.next());
}
bof = null;
if(excelFile.hasNext())
{
r = excelFile.next();
if(r.getType() == Type.BOF)
bof = new BOFRecord(r);
}
} while(true);
}
public FormattingRecords getFormattingRecords()
{
return formattingRecords;
}
public ExternalSheetRecord getExternalSheetRecord()
{
return externSheet;
}
public MsoDrawingGroupRecord getMsoDrawingGroupRecord()
{
return msoDrawingGroup;
}
public SupbookRecord[] getSupbookRecords()
{
SupbookRecord sr[] = new SupbookRecord[supbooks.size()];
return (SupbookRecord[])supbooks.toArray(sr);
}
public NameRecord[] getNameRecords()
{
NameRecord na[] = new NameRecord[nameTable.size()];
return (NameRecord[])nameTable.toArray(na);
}
public Fonts getFonts()
{
return fonts;
}
public Cell getCell(String loc)
{
Sheet s = getSheet(CellReferenceHelper.getSheet(loc));
return s.getCell(loc);
}
public Cell findCellByName(String name)
{
NameRecord nr = (NameRecord)namedRecords.get(name);
if(nr == null)
return null;
NameRecord.NameRange ranges[] = nr.getRanges();
Sheet s = getSheet(getExternalSheetIndex(ranges[0].getExternalSheet()));
int col = ranges[0].getFirstColumn();
int row = ranges[0].getFirstRow();
if(col > s.getColumns() || row > s.getRows())
{
return new EmptyCell(col, row);
} else
{
Cell cell = s.getCell(col, row);
return cell;
}
}
public Range[] findByName(String name)
{
NameRecord nr = (NameRecord)namedRecords.get(name);
if(nr == null)
return null;
NameRecord.NameRange ranges[] = nr.getRanges();
Range cellRanges[] = new Range[ranges.length];
for(int i = 0; i < ranges.length; i++)
cellRanges[i] = new RangeImpl(this, getExternalSheetIndex(ranges[i].getExternalSheet()), ranges[i].getFirstColumn(), ranges[i].getFirstRow(), getLastExternalSheetIndex(ranges[i].getExternalSheet()), ranges[i].getLastColumn(), ranges[i].getLastRow());
return cellRanges;
}
public String[] getRangeNames()
{
Object keys[] = namedRecords.keySet().toArray();
String names[] = new String[keys.length];
System.arraycopy(((Object) (keys)), 0, names, 0, keys.length);
return names;
}
public BOFRecord getWorkbookBof()
{
return workbookBof;
}
public boolean isProtected()
{
return wbProtected;
}
public WorkbookSettings getSettings()
{
return settings;
}
public int getExternalSheetIndex(String sheetName)
{
return 0;
}
public int getLastExternalSheetIndex(String sheetName)
{
return 0;
}
public String getName(int index)
{
Assert.verify(index >= 0 && index < nameTable.size());
return ((NameRecord)nameTable.get(index)).getName();
}
public int getNameIndex(String name)
{
NameRecord nr = (NameRecord)namedRecords.get(name);
return nr == null ? 0 : nr.getIndex();
}
public DrawingGroup getDrawingGroup()
{
return drawingGroup;
}
public CompoundFile getCompoundFile()
{
return excelFile.getCompoundFile();
}
public boolean containsMacros()
{
return containsMacros;
}
public ButtonPropertySetRecord getButtonPropertySet()
{
return buttonPropertySet;
}
public CountryRecord getCountryRecord()
{
return countryRecord;
}
public String[] getAddInFunctionNames()
{
String addins[] = new String[0];
return (String[])addInFunctions.toArray(addins);
}
static Class class$(String x0)
{
return Class.forName(x0);
ClassNotFoundException x1;
x1;
throw new NoClassDefFoundError(x1.getMessage());
}
static
{
logger = Logger.getLogger(class$jxl$read$biff$WorkbookParser != null ? class$jxl$read$biff$WorkbookParser : (class$jxl$read$biff$WorkbookParser = class$("jxl.read.biff.WorkbookParser")));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -