public static Worksheet Decode(Workbook book, Stream stream, SharedResource sharedResource) { Worksheet worksheet = new Worksheet(); worksheet.Book = book; List <Record> list = WorksheetDecoder.ReadRecords(stream, out worksheet.Drawing); worksheet.Cells = WorksheetDecoder.PopulateCells(list, sharedResource); worksheet.Book.Records.AddRange(list); return(worksheet); }
public static FONT getFontForCharacter(Cell cell, ushort charIndex) { FONT result = null; int num = cell.Style.RichTextFormat.CharIndexes.BinarySearch(charIndex); List <ushort> fontIndexes = cell.Style.RichTextFormat.FontIndexes; if (num >= 0) { result = WorksheetDecoder.getFontRecord(cell.SharedResource, fontIndexes[num]); } else { if (~num != 0) { result = WorksheetDecoder.getFontRecord(cell.SharedResource, fontIndexes[checked (~num - 1)]); } } return(result); }
public static Workbook Decode(Stream stream) { Workbook book = new Workbook(); SharedResource sharedResource; List <Record> records = ReadRecords(stream, out book.DrawingGroup); book.Records = records; List <BOUNDSHEET> boundSheets = DecodeRecords(records, out sharedResource); foreach (BOUNDSHEET boundSheet in boundSheets) { stream.Position = boundSheet.StreamPosition; Worksheet sheet = WorksheetDecoder.Decode(book, stream, sharedResource); sheet.Book = book; sheet.Name = boundSheet.SheetName; sheet.SheetType = (SheetType)boundSheet.SheetType; book.Worksheets.Add(sheet); } return(book); }
public static Workbook Decode(Stream stream) { Workbook workbook = new Workbook(); List <Record> records = WorkbookDecoder.ReadRecords(stream, out workbook.DrawingGroup); workbook.Records = records; SharedResource sharedResource; List <BOUNDSHEET> list = WorkbookDecoder.DecodeRecords(records, out sharedResource); foreach (BOUNDSHEET current in list) { stream.Position = (long)((ulong)current.StreamPosition); Worksheet worksheet = WorksheetDecoder.Decode(workbook, stream, sharedResource); worksheet.Book = workbook; worksheet.Name = current.SheetName; worksheet.SheetType = (SheetType)current.SheetType; workbook.Worksheets.Add(worksheet); } return(workbook); }