// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html// Decompiler options: packimports(3) fieldsfirst ansi // Source File Name: SheetCopier.javapackage jxl.write.biff;import common.Assert;import common.Logger;import java.util.*;import jxl.*;import jxl.biff.*;import jxl.biff.drawing.*;import jxl.format.CellFormat;import jxl.read.biff.*;import jxl.write.*;// Referenced classes of package jxl.write.biff:// WritableSheetImpl, ColumnInfoRecord, RowsExceededException, CellValue, // PLSRecord, ButtonPropertySetRecord, ReadNumberFormulaRecord, ReadStringFormulaRecord, // ReadBooleanFormulaRecord, ReadDateFormulaRecord, ReadErrorFormulaRecord, WritableWorkbookImpl, // MergedCells, RowRecord, SheetWriterclass SheetCopier{ private static Logger logger; private SheetImpl fromSheet; private WritableSheetImpl toSheet; private WorkbookSettings workbookSettings; private TreeSet columnFormats; private FormattingRecords formatRecords; private ArrayList hyperlinks; private MergedCells mergedCells; private ArrayList rowBreaks; private ArrayList columnBreaks; private SheetWriter sheetWriter; private ArrayList drawings; private ArrayList images; private DataValidation dataValidation; private ComboBox comboBox; private PLSRecord plsRecord; private boolean chartOnly; private ButtonPropertySetRecord buttonPropertySet; private HashMap xfRecords; private HashMap fonts; private HashMap formats; static Class class$jxl$write$biff$SheetCopier; /* synthetic field */ public SheetCopier(Sheet f, WritableSheet t) { fromSheet = (SheetImpl)f; toSheet = (WritableSheetImpl)t; workbookSettings = toSheet.getWorkbook().getSettings(); chartOnly = false; } void setColumnFormats(TreeSet cf) { columnFormats = cf; } void setFormatRecords(FormattingRecords fr) { formatRecords = fr; } void setHyperlinks(ArrayList h) { hyperlinks = h; } void setMergedCells(MergedCells mc) { mergedCells = mc; } void setRowBreaks(ArrayList rb) { rowBreaks = rb; } void setColumnBreaks(ArrayList cb) { columnBreaks = cb; } void setSheetWriter(SheetWriter sw) { sheetWriter = sw; } void setDrawings(ArrayList d) { drawings = d; } void setImages(ArrayList i) { images = i; } DataValidation getDataValidation() { return dataValidation; } ComboBox getComboBox() { return comboBox; } PLSRecord getPLSRecord() { return plsRecord; } boolean isChartOnly() { return chartOnly; } ButtonPropertySetRecord getButtonPropertySet() { return buttonPropertySet; } public void copySheet() { shallowCopyCells(); ColumnInfoRecord readCirs[] = fromSheet.getColumnInfos(); for(int i = 0; i < readCirs.length; i++) { ColumnInfoRecord rcir = readCirs[i]; for(int j = rcir.getStartColumn(); j { jxl.write.biff.ColumnInfoRecord cir = new jxl.write.biff.ColumnInfoRecord(rcir, j, formatRecords); cir.setHidden(rcir.getHidden()); columnFormats.add(cir); } } jxl.Hyperlink hls[] = fromSheet.getHyperlinks(); for(int i = 0; i < hls.length; i++) { WritableHyperlink hr = new WritableHyperlink(hls[i], toSheet); hyperlinks.add(hr); } jxl.Range merged[] = fromSheet.getMergedCells(); for(int i = 0; i < merged.length; i++) mergedCells.add(new SheetRangeImpl((SheetRangeImpl)merged[i], toSheet)); try { RowRecord rowprops[] = fromSheet.getRowProperties(); for(int i = 0; i < rowprops.length; i++) { jxl.write.biff.RowRecord rr = toSheet.getRowRecord(rowprops[i].getRowNumber()); XFRecord format = rowprops[i].hasDefaultFormat() ? formatRecords.getXFRecord(rowprops[i].getXFIndex()) : null; rr.setRowDetails(rowprops[i].getRowHeight(), rowprops[i].matchesDefaultFontHeight(), rowprops[i].isCollapsed(), format); } } catch(RowsExceededException e) { Assert.verify(false); } int rowbreaks[] = fromSheet.getRowPageBreaks(); if(rowbreaks != null) { for(int i = 0; i < rowbreaks.length; i++) rowBreaks.add(new Integer(rowbreaks[i])); } int columnbreaks[] = fromSheet.getColumnPageBreaks(); if(columnbreaks != null) { for(int i = 0; i < columnbreaks.length; i++) columnBreaks.add(new Integer(columnbreaks[i])); } sheetWriter.setCharts(fromSheet.getCharts()); jxl.biff.drawing.DrawingGroupObject dr[] = fromSheet.getDrawings(); for(int i = 0; i < dr.length; i++) { if(dr[i] instanceof Drawing) { WritableImage wi = new WritableImage(dr[i], toSheet.getWorkbook().getDrawingGroup()); drawings.add(wi); images.add(wi); continue; } if(dr[i] instanceof Comment) { Comment c = new Comment(dr[i], toSheet.getWorkbook().getDrawingGroup(), workbookSettings); drawings.add(c); CellValue cv = (CellValue)toSheet.getWritableCell(c.getColumn(), c.getRow()); Assert.verify(cv.getCellFeatures() != null); cv.getWritableCellFeatures().setCommentDrawing(c); continue; } if(dr[i] instanceof Button) { Button b = new Button(dr[i], toSheet.getWorkbook().getDrawingGroup(), workbookSettings); drawings.add(b); continue; } if(dr[i] instanceof ComboBox) { ComboBox cb = new ComboBox(dr[i], toSheet.getWorkbook().getDrawingGroup(), workbookSettings); drawings.add(cb); } } DataValidation rdv = fromSheet.getDataValidation(); if(rdv != null) { dataValidation = new DataValidation(rdv, toSheet.getWorkbook(), toSheet.getWorkbook(), workbookSettings); int objid = dataValidation.getComboBoxObjectId(); if(objid != 0) comboBox = (ComboBox)drawings.get(objid); } sheetWriter.setWorkspaceOptions(fromSheet.getWorkspaceOptions()); if(fromSheet.getSheetBof().isChart()) { chartOnly = true; sheetWriter.setChartOnly(); } if(fromSheet.getPLS() != null) if(fromSheet.getWorkbookBof().isBiff7()) logger.warn("Cannot copy Biff7 print settings record - ignoring"); else plsRecord = new PLSRecord(fromSheet.getPLS()); if(fromSheet.getButtonPropertySet() != null) buttonPropertySet = new ButtonPropertySetRecord(fromSheet.getButtonPropertySet()); } public void importSheet() { xfRecords = new HashMap(); fonts = new HashMap(); formats = new HashMap(); deepCopyCells(); ColumnInfoRecord readCirs[] = fromSheet.getColumnInfos(); for(int i = 0; i < readCirs.length; i++) { ColumnInfoRecord rcir = readCirs[i]; for(int j = rcir.getStartColumn(); j
java的snmp编程_sheetcopier.java 源代码在线查看 - 主要介绍snmp编程的一些例子对于snmp编程的人非常重要 资源下载 虫虫电子下载站...
最新推荐文章于 2021-03-05 14:30:20 发布