sheetjs-clone/odsbits/40_helpers.js
SheetJS f9097d403b version bump 0.7.12: cell type 'd'
- more structure in the theme parsing
- cellDates option on parsing side creates date cells
- cellDates option on writing side creates cells with type 'd'
- cell types clarified, type 'str' phased out
- README clarifications
- more tests to ensure date consistency
- more test cases for ODS
2014-10-26 01:26:18 -04:00

21 lines
816 B
JavaScript

var parse_text_p = function(text, tag) {
return utf8read(text.replace(/<text:s\/>/g," ").replace(/<[^>]*>/g,""));
};
var utf8read = function utf8reada(orig) {
var out = "", i = 0, c = 0, d = 0, e = 0, f = 0, w = 0;
while (i < orig.length) {
c = orig.charCodeAt(i++);
if (c < 128) { out += String.fromCharCode(c); continue; }
d = orig.charCodeAt(i++);
if (c>191 && c<224) { out += String.fromCharCode(((c & 31) << 6) | (d & 63)); continue; }
e = orig.charCodeAt(i++);
if (c < 240) { out += String.fromCharCode(((c & 15) << 12) | ((d & 63) << 6) | (e & 63)); continue; }
f = orig.charCodeAt(i++);
w = (((c & 7) << 18) | ((d & 63) << 12) | ((e & 63) << 6) | (f & 63))-65536;
out += String.fromCharCode(0xD800 + ((w>>>10)&1023));
out += String.fromCharCode(0xDC00 + (w&1023));
}
return out;
};