public int Serialize(int offset, byte[] data){int pos = 0;SSTRecord sst = null;int sstPos = 0;bool wroteBoundSheets = false;for (int k = 0; k < records.Count; k++){Record record = records[k];if (record.Sid != RecalcIdRecord.sid || ((RecalcIdRecord)record).IsNeeded){int len = 0;if (record is SSTRecord){sst = (SSTRecord)record;sstPos = pos;}if (record.Sid == ExtSSTRecord.sid && sst != null){record = sst.CreateExtSSTRecord(sstPos + offset);}if (record is BoundSheetRecord){if (!wroteBoundSheets){for (int i = 0; i < boundsheets.Count; i++){len += ((BoundSheetRecord)boundsheets[i]).Serialize(pos + offset + len, data);}wroteBoundSheets = true;}}else{len = record.Serialize(pos + offset, data);}pos += len;   }}return pos;}