Search in sources :

Example 1 with InterfaceHdrRecord

use of org.apache.poi.hssf.record.InterfaceHdrRecord in project poi by apache.

the class InternalWorkbook method createWorkbook.

/**
     * Creates an empty workbook object with three blank sheets and all the empty
     * fields.  Use this to create a workbook from scratch.
     *
     * @return an empty workbook object
     */
public static InternalWorkbook createWorkbook() {
    LOG.log(DEBUG, "creating new workbook from scratch");
    InternalWorkbook retval = new InternalWorkbook();
    List<Record> records = new ArrayList<Record>(30);
    retval.records.setRecords(records);
    List<FormatRecord> formats = retval.formats;
    records.add(createBOF());
    records.add(new InterfaceHdrRecord(CODEPAGE));
    records.add(createMMS());
    records.add(InterfaceEndRecord.instance);
    records.add(createWriteAccess());
    records.add(createCodepage());
    records.add(createDSF());
    records.add(createTabId());
    retval.records.setTabpos(records.size() - 1);
    records.add(createFnGroupCount());
    records.add(createWindowProtect());
    records.add(createProtect());
    retval.records.setProtpos(records.size() - 1);
    records.add(createPassword());
    records.add(createProtectionRev4());
    records.add(createPasswordRev4());
    retval.windowOne = createWindowOne();
    records.add(retval.windowOne);
    records.add(createBackup());
    retval.records.setBackuppos(records.size() - 1);
    records.add(createHideObj());
    records.add(createDateWindow1904());
    records.add(createPrecision());
    records.add(createRefreshAll());
    records.add(createBookBool());
    records.add(createFont());
    records.add(createFont());
    records.add(createFont());
    records.add(createFont());
    // last font record position
    retval.records.setFontpos(records.size() - 1);
    retval.numfonts = 4;
    // set up format records
    for (int i = 0; i <= 7; i++) {
        FormatRecord rec = createFormat(i);
        retval.maxformatid = retval.maxformatid >= rec.getIndexCode() ? retval.maxformatid : rec.getIndexCode();
        formats.add(rec);
        records.add(rec);
    }
    for (int k = 0; k < 21; k++) {
        records.add(InternalWorkbook.createExtendedFormat(k));
        retval.numxfs++;
    }
    retval.records.setXfpos(records.size() - 1);
    for (int k = 0; k < 6; k++) {
        records.add(InternalWorkbook.createStyle(k));
    }
    records.add(InternalWorkbook.createUseSelFS());
    // now just do 1
    int nBoundSheets = 1;
    for (int k = 0; k < nBoundSheets; k++) {
        BoundSheetRecord bsr = createBoundSheet(k);
        records.add(bsr);
        retval.boundsheets.add(bsr);
        retval.records.setBspos(records.size() - 1);
    }
    records.add(InternalWorkbook.createCountry());
    for (int k = 0; k < nBoundSheets; k++) {
        retval.getOrCreateLinkTable().checkExternSheet(k);
    }
    retval.sst = new SSTRecord();
    records.add(retval.sst);
    records.add(InternalWorkbook.createExtendedSST());
    records.add(EOFRecord.instance);
    LOG.log(DEBUG, "exit create new workbook from scratch");
    return retval;
}
Also used : InterfaceHdrRecord(org.apache.poi.hssf.record.InterfaceHdrRecord) ArrayList(java.util.ArrayList) WindowProtectRecord(org.apache.poi.hssf.record.WindowProtectRecord) PasswordRev4Record(org.apache.poi.hssf.record.PasswordRev4Record) DateWindow1904Record(org.apache.poi.hssf.record.DateWindow1904Record) FormatRecord(org.apache.poi.hssf.record.FormatRecord) BookBoolRecord(org.apache.poi.hssf.record.BookBoolRecord) StyleRecord(org.apache.poi.hssf.record.StyleRecord) RecalcIdRecord(org.apache.poi.hssf.record.RecalcIdRecord) EscherBSERecord(org.apache.poi.ddf.EscherBSERecord) EscherOptRecord(org.apache.poi.ddf.EscherOptRecord) HideObjRecord(org.apache.poi.hssf.record.HideObjRecord) Record(org.apache.poi.hssf.record.Record) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) HyperlinkRecord(org.apache.poi.hssf.record.HyperlinkRecord) ProtectionRev4Record(org.apache.poi.hssf.record.ProtectionRev4Record) EOFRecord(org.apache.poi.hssf.record.EOFRecord) MMSRecord(org.apache.poi.hssf.record.MMSRecord) PrecisionRecord(org.apache.poi.hssf.record.PrecisionRecord) BoundSheetRecord(org.apache.poi.hssf.record.BoundSheetRecord) CountryRecord(org.apache.poi.hssf.record.CountryRecord) EscherSpRecord(org.apache.poi.ddf.EscherSpRecord) NameCommentRecord(org.apache.poi.hssf.record.NameCommentRecord) FnGroupCountRecord(org.apache.poi.hssf.record.FnGroupCountRecord) DrawingGroupRecord(org.apache.poi.hssf.record.DrawingGroupRecord) BackupRecord(org.apache.poi.hssf.record.BackupRecord) EscherSplitMenuColorsRecord(org.apache.poi.ddf.EscherSplitMenuColorsRecord) ExternSheetRecord(org.apache.poi.hssf.record.ExternSheetRecord) WriteAccessRecord(org.apache.poi.hssf.record.WriteAccessRecord) EscherDggRecord(org.apache.poi.ddf.EscherDggRecord) CodepageRecord(org.apache.poi.hssf.record.CodepageRecord) EscherRecord(org.apache.poi.ddf.EscherRecord) NameRecord(org.apache.poi.hssf.record.NameRecord) BOFRecord(org.apache.poi.hssf.record.BOFRecord) FilePassRecord(org.apache.poi.hssf.record.FilePassRecord) FontRecord(org.apache.poi.hssf.record.FontRecord) UseSelFSRecord(org.apache.poi.hssf.record.UseSelFSRecord) WindowOneRecord(org.apache.poi.hssf.record.WindowOneRecord) WriteProtectRecord(org.apache.poi.hssf.record.WriteProtectRecord) ProtectRecord(org.apache.poi.hssf.record.ProtectRecord) InterfaceHdrRecord(org.apache.poi.hssf.record.InterfaceHdrRecord) DSFRecord(org.apache.poi.hssf.record.DSFRecord) InterfaceEndRecord(org.apache.poi.hssf.record.InterfaceEndRecord) SupBookRecord(org.apache.poi.hssf.record.SupBookRecord) SSTRecord(org.apache.poi.hssf.record.SSTRecord) TabIdRecord(org.apache.poi.hssf.record.TabIdRecord) PasswordRecord(org.apache.poi.hssf.record.PasswordRecord) PaletteRecord(org.apache.poi.hssf.record.PaletteRecord) EscherDgRecord(org.apache.poi.ddf.EscherDgRecord) ExtSSTRecord(org.apache.poi.hssf.record.ExtSSTRecord) ExtendedFormatRecord(org.apache.poi.hssf.record.ExtendedFormatRecord) FileSharingRecord(org.apache.poi.hssf.record.FileSharingRecord) RefreshAllRecord(org.apache.poi.hssf.record.RefreshAllRecord) FormatRecord(org.apache.poi.hssf.record.FormatRecord) ExtendedFormatRecord(org.apache.poi.hssf.record.ExtendedFormatRecord) SSTRecord(org.apache.poi.hssf.record.SSTRecord) ExtSSTRecord(org.apache.poi.hssf.record.ExtSSTRecord) BoundSheetRecord(org.apache.poi.hssf.record.BoundSheetRecord)

Aggregations

ArrayList (java.util.ArrayList)1 EscherBSERecord (org.apache.poi.ddf.EscherBSERecord)1 EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)1 EscherDgRecord (org.apache.poi.ddf.EscherDgRecord)1 EscherDggRecord (org.apache.poi.ddf.EscherDggRecord)1 EscherOptRecord (org.apache.poi.ddf.EscherOptRecord)1 EscherRecord (org.apache.poi.ddf.EscherRecord)1 EscherSpRecord (org.apache.poi.ddf.EscherSpRecord)1 EscherSplitMenuColorsRecord (org.apache.poi.ddf.EscherSplitMenuColorsRecord)1 BOFRecord (org.apache.poi.hssf.record.BOFRecord)1 BackupRecord (org.apache.poi.hssf.record.BackupRecord)1 BookBoolRecord (org.apache.poi.hssf.record.BookBoolRecord)1 BoundSheetRecord (org.apache.poi.hssf.record.BoundSheetRecord)1 CodepageRecord (org.apache.poi.hssf.record.CodepageRecord)1 CountryRecord (org.apache.poi.hssf.record.CountryRecord)1 DSFRecord (org.apache.poi.hssf.record.DSFRecord)1 DateWindow1904Record (org.apache.poi.hssf.record.DateWindow1904Record)1 DrawingGroupRecord (org.apache.poi.hssf.record.DrawingGroupRecord)1 EOFRecord (org.apache.poi.hssf.record.EOFRecord)1 ExtSSTRecord (org.apache.poi.hssf.record.ExtSSTRecord)1