Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

version bump 0.4.12: updating CFB dependency

  • Loading branch information...
commit 696e03d106b0ef77a3f0bfd14ca6f1299fa19f7e 1 parent 0e0466d
@SheetJSDev SheetJSDev authored
View
13 bits/18_cfb.js
@@ -189,14 +189,9 @@ function read_directory(idx) {
minifat_size = o.size;
} else if(o.size >= ms_cutoff_size) {
o.storage = 'fat';
- try {
- sector_list[o.start].name = o.name;
- o.content = sector_list[o.start].data.slice(0,o.size);
- } catch(e) {
- o.start = o.start - 1;
- sector_list[o.start].name = o.name;
- o.content = sector_list[o.start].data.slice(0,o.size);
- }
+ if(!sector_list[o.start] && dir_start > 0) o.start = (o.start + dir_start) % sectors.length;
+ sector_list[o.start].name = o.name;
+ o.content = sector_list[o.start].data.slice(0,o.size);
prep_blob(o.content);
} else {
o.storage = 'minifat';
@@ -269,11 +264,9 @@ function find_path(path) {
var rval = {
raw: {header: header, sectors: sectors},
- Paths: Paths,
FileIndex: FileIndex,
FullPaths: FullPaths,
FullPathDir: FullPathDir,
- Directory: files,
find: find_path
};
View
104 misc/cfb.d.ts
@@ -0,0 +1,104 @@
+declare enum CFBEntryType { unknown, storage, stream, lockbytes, property, root }
+declare enum CFBStorageType { fat, minifat }
+
+/* CFB Entry Object demanded by write functions */
+interface CFBEntryMin {
+
+ /* Raw Content (Buffer when available, Array of bytes otherwise) */
+ content:any;
+}
+
+/* CFB Entry Object returned by parse functions */
+interface CFBEntry extends CFBEntryMin {
+
+ /* Case-sensitive internal name */
+ name:string;
+
+ /* CFB type (salient types: stream, storage) -- see CFBEntryType */
+ type:string;
+
+ /* Creation Time */
+ ct:Date;
+ /* Modification Time */
+ mt:Date;
+
+
+ /* Raw creation time -- see [MS-DTYP] 2.3.3 FILETIME */
+ mtime:string;
+ /* Raw modification time -- see [MS-DTYP] 2.3.3 FILETIME */
+ ctime:string;
+
+ /* RBT color: 0 = red, 1 = black */
+ color:number;
+
+ /* Class ID represented as hex string */
+ clsid:string;
+
+ /* User-Defined State Bits */
+ state:number;
+
+ /* Starting Sector */
+ start:number;
+
+ /* Data Size */
+ size:number;
+
+ /* Storage location -- see CFBStorageType */
+ storage:string;
+}
+
+
+/* cfb.FullPathDir as demanded by write functions */
+interface CFBDirectoryMin {
+
+ /* keys are unix-style paths */
+ [key:string]: CFBEntryMin;
+}
+
+/* cfb.FullPathDir Directory object */
+interface CFBDirectory extends CFBDirectoryMin {
+
+ /* cfb.FullPathDir keys are paths; cfb.Directory keys are file names */
+ [key:string]: CFBEntry;
+}
+
+
+/* cfb object demanded by write functions */
+interface CFBContainerMin {
+
+ /* Path -> CFB object mapping */
+ FullPathDir:CFBDirectoryMin;
+}
+
+/* cfb object returned by read and parse functions */
+interface CFBContainer extends CFBContainerMin {
+
+ /* search by path or file name */
+ find(string):CFBEntry;
+
+ /* list of streams and storages */
+ FullPaths:string[];
+
+ /* Path -> CFB object mapping */
+ FullPathDir:CFBDirectory;
+
+ /* Array of entries in the same order as FullPaths */
+ FileIndex:CFBEntry[];
+
+ /* Raw Content, in chunks (Buffer when available, Array of bytes otherwise) */
+ raw:any[];
+}
+
+
+interface CFB {
+ read(f:any, options:any):CFBContainer;
+ parse(f:any):CFBContainer;
+ utils: {
+ ReadShift(size:any,t?:any):any;
+ WarnField(hexstr:string,fld?:string);
+ CheckField(hexstr:string,fld?:string);
+ prep_blob(blob:any, pos?:number):any;
+ bconcat(bufs:any[]):any;
+ };
+ main;
+}
View
26 misc/xl.d.ts
@@ -1,18 +1,4 @@
-interface CFBFile {
-}
-
-interface CFB {
- read;
- parse;
- utils: {
- ReadShift;
- WarnField;
- CheckField;
- prep_blob;
- bconcat;
- };
- main;
-}
+///<reference path='cfb.d.ts'/>
interface Cell {
v;
@@ -31,8 +17,12 @@ interface CellRange {
e: CellAddress;
}
-interface Worksheet {
- //'!range':CellRange;
+interface WorksheetBase {
+ '!range':CellRange;
+ '!ref':string;
+}
+
+interface Worksheet extends WorksheetBase {
[key: string]: Cell;
}
@@ -46,7 +36,7 @@ interface Workbook {
}
interface XLS {
- parse_xlscfb(cfb:CFBFile): Workbook;
+ parse_xlscfb(cfb:CFBContainer): Workbook;
read;
readFile(filename: string): Workbook;
utils: {
View
4 package.json
@@ -1,6 +1,6 @@
{
"name": "xlsjs",
- "version": "0.4.11-a",
+ "version": "0.4.12",
"author": "sheetjs",
"description": "(one day) a full-featured XLS parser and writer. For now, primitive parser",
"keywords": [ "xls", "office", "excel", "spreadsheet" ],
@@ -9,7 +9,7 @@
},
"main": "./xls",
"dependencies": {
- "cfb":">=0.6.0",
+ "cfb":">=0.8.0",
"ssf":"",
"codepage":"",
"commander":""
View
13 xls.js
@@ -1013,14 +1013,9 @@ function read_directory(idx) {
minifat_size = o.size;
} else if(o.size >= ms_cutoff_size) {
o.storage = 'fat';
- try {
- sector_list[o.start].name = o.name;
- o.content = sector_list[o.start].data.slice(0,o.size);
- } catch(e) {
- o.start = o.start - 1;
- sector_list[o.start].name = o.name;
- o.content = sector_list[o.start].data.slice(0,o.size);
- }
+ if(!sector_list[o.start] && dir_start > 0) o.start = (o.start + dir_start) % sectors.length;
+ sector_list[o.start].name = o.name;
+ o.content = sector_list[o.start].data.slice(0,o.size);
prep_blob(o.content);
} else {
o.storage = 'minifat';
@@ -1093,11 +1088,9 @@ function find_path(path) {
var rval = {
raw: {header: header, sectors: sectors},
- Paths: Paths,
FileIndex: FileIndex,
FullPaths: FullPaths,
FullPathDir: FullPathDir,
- Directory: files,
find: find_path
};
Please sign in to comment.
Something went wrong with that request. Please try again.