-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for missing cell reference #10
Conversation
(def tags | ||
"Map of Excel XML namespaces of interest" | ||
{:sheet-tag #{:sheets | ||
:xmlns.http%3A%2F%2Fschemas.openxmlformats.org%2Fspreadsheetml%2F2006%2Fmain/sheets | ||
:xmlns.http%3A%2F%2Fpurl.oclc.org%2Fooxml%2Fspreadsheetml%2Fmain/sheets} | ||
:row-tag #{:row | ||
:xmlns.http%3A%2F%2Fschemas.openxmlformats.org%2Fspreadsheetml%2F2006%2Fmain/row | ||
:xmlns.http%3A%2F%2Fpurl.oclc.org%2Fooxml%2Fspreadsheetml%2Fmain/row} | ||
:text-part #{:si | ||
:xmlns.http%3A%2F%2Fschemas.openxmlformats.org%2Fspreadsheetml%2F2006%2Fmain/si | ||
:xmlns.http%3A%2F%2Fpurl.oclc.org%2Fooxml%2Fspreadsheetml%2Fmain/si} | ||
:numFmts #{:numFmts | ||
:xmlns.http%3A%2F%2Fschemas.openxmlformats.org%2Fspreadsheetml%2F2006%2Fmain/numFmts | ||
:xmlns.http%3A%2F%2Fpurl.oclc.org%2Fooxml%2Fspreadsheetml%2Fmain/numFmts} | ||
:cellxfs #{:cellXfs | ||
:xmlns.http%3A%2F%2Fschemas.openxmlformats.org%2Fspreadsheetml%2F2006%2Fmain/cellXfs | ||
:xmlns.http%3A%2F%2Fpurl.oclc.org%2Fooxml%2Fspreadsheetml%2Fmain/cellXfs} | ||
:xf #{:xf | ||
:xmlns.http%3A%2F%2Fschemas.openxmlformats.org%2Fspreadsheetml%2F2006%2Fmain/xf | ||
:xmlns.http%3A%2F%2Fpurl.oclc.org%2Fooxml%2Fspreadsheetml%2Fmain/xf} | ||
:text-t #{:t | ||
:xmlns.http%3A%2F%2Fschemas.openxmlformats.org%2Fspreadsheetml%2F2006%2Fmain/t | ||
:xmlns.http%3A%2F%2Fpurl.oclc.org%2Fooxml%2Fspreadsheetml%2Fmain/t} | ||
:text-r #{:r | ||
:xmlns.http%3A%2F%2Fschemas.openxmlformats.org%2Fspreadsheetml%2F2006%2Fmain/r | ||
:xmlns.http%3A%2F%2Fpurl.oclc.org%2Fooxml%2Fspreadsheetml%2Fmain/r} | ||
:sheet-data #{:sheetData | ||
:xmlns.http%3A%2F%2Fschemas.openxmlformats.org%2Fspreadsheetml%2F2006%2Fmain/sheetData | ||
:xmlns.http%3A%2F%2Fpurl.oclc.org%2Fooxml%2Fspreadsheetml%2Fmain/sheetData} | ||
:sheet-id #{:id | ||
:xmlns.http%3A%2F%2Fschemas.openxmlformats.org%2FofficeDocument%2F2006%2Frelationships/id | ||
:xmlns.http%3A%2F%2Fpurl.oclc.org%2Fooxml%2FofficeDocument%2Frelationships/id}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With namespace-aware arg of (xml/parse styles {:namespace-aware false})
and by-tag
pred in util ns i thought we can avoid verbose tag description
[^ZipFile zipfile] | ||
(if-let [wb (.getEntry zipfile "xl/styles.xml")] | ||
(let [ins (.getInputStream zipfile wb) | ||
x (parse-str (slurp ins))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change here and next slurp to .getInputStream for optimal memory usage
(defn number->column-letter | ||
[n] | ||
(loop [num n | ||
acc ""] | ||
(if (> num 0) | ||
(let [residue (mod (dec num) 26) | ||
new-num (quot (dec num) 26)] | ||
(recur new-num (str (char (+ residue A_CHAR_INDEX)) acc))) | ||
acc))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this functionality can add new option to retrieve rows with number cell index If this may be of interest to anyone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After PR work faster in my test one colum file with 1048576 rows, like 25% of perfomance rise
wip fix fix fix fix fix fix fix fix fix fix fix fix fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question about current functionality
No description provided.