-
Notifications
You must be signed in to change notification settings - Fork 112
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
Implement xlsxioread_sheet_next_cell_struct with cell types #47
base: master
Are you sure you want to change the base?
Conversation
(First commit message, yay!)
Move structs to the top Add xlsxioread_debug_internals(xlsxioreader) Add xlsxio_read_struct in xlsxio_read.h (now its with alias and without)
Do you know how to install specify minizip path in windows? |
You can tell XLSX I/O buid to use a specific Minizip install location with the CMake parameter -DMINIZIP_DIR:PATH= I have started reviewing some of your code, and already have several remarks:
|
I not sure about licenses, will it be better if we download utarray.h and uthash.h in a make file? I don't think we gonna have many styles, so performance not so critical. |
What should we do with malloc? check |
I deleted files inside build folder, is it ok? (I don't know what those files was for) |
I usually do:
that way you don't assume malloc worked causing the application to crash or even to allow hacker to exploit this. The build folder contains the Code::Blocks project files, which I use to develop and debug on Windows. uthash is a package in most package systems (e.g. uthash-dev apt package on Debian Linux). Question: |
Will try to make malloc as suggested and bring back
it was in code uploaded in #12 and I keep it. It is used to find relations between cell and number format: Example styles.xml: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<numFmts count="2">
<numFmt numFmtId="164" formatCode="#,##0.00"/>
<numFmt numFmtId="165" formatCode="[$-409]m/d/yy h:mm AM/PM;@"/>
</numFmts>
...
<cellStyleXfs count="1">
<xf numFmtId="0" fontId="0" fillId="0" borderId="0"/>
</cellStyleXfs>
<cellXfs count="3">
<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>
<xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>
<xf numFmtId="165" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>
</cellXfs>
<cellStyles count="1">
<cellStyle name="Normal" xfId="0" builtinId="0"/>
</cellStyles>
<dxfs count="0"/>
<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleLight16"/>
</styleSheet> Example sheet.xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<dimension ref="A1:G5"/>
...
<cols>
<col min="2" max="2" width="20.7109375" style="1" customWidth="1"/>
<col min="3" max="3" width="20.7109375" style="2" customWidth="1"/>
</cols>
<sheetData>
<row r="1" spans="1:7">
<c r="A1" t="s">
<v>0</v>
</c>
<c r="B1" s="1">
<v>1234</v>
</c>
<c r="C1" s="2">
<v>43537.51777806081</v>
</c>
<c r="D1">
<v>1234</v>
</c>
<c r="E1" t="b">
<v>1</v>
</c>
<c r="F1">
<f>(B1 * 2)</f>
<v>0</v>
</c>
<c r="G1" t="s">
<v>1</v>
</c>
</row>
<row r="5" s="2" customFormat="1" ht="20" customHeight="1"/>
</sheetData>
<hyperlinks>
<hyperlink ref="G1" r:id="rId1"/>
</hyperlinks>
<pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>
</worksheet> In example files
From format code we can recognize it's a date, not just number. This code also consider builtin number formats 14 - 22. If For now only on cell-level, I tried to create file with row format and column format, but when extract xml files, and each cell will have style reference e.g Btw where do you find format specification? |
Styles are numbered. That's why I was wondering why hashing was used. A (sparse) array structure would do for this. How much of the API is modified? I'm assuming your changes are not very backwards compatible? |
I changed code to use arrays of structs, but not sure if I implemented it correctly, especially memory allocation and memory releasing. So not using utarray and uthash anymore
Should be totally backwards compatible, changed What is your preferences for variable names? camelCase or snake_case? e.g. handle->numberFormats or handle->number_formats? |
Wow, you're quick! |
done |
may be you know how to install minizip on windows? or is windows build is important at all? |
For me MinGW in Windows is my primary development platform, but I also make sure it builds on Debian Linux and macOS.
If you need binaries I could send them to you if you like. |
Hi, all. |
Do you have example of a file? |
Thank you @AlexanderBurtasov for founding a bug. I fixed it |
17596_reduced.xlsx |
@AlexanderBurtasov fixed |
I took suggested implementation from #12 and add new method to keep existing API same
Fixes #12
Now I found similar fork matejd@a0b6a0b
Travis status: (https://travis-ci.org/Paxa/xlsxio)
How to use
xlsxioread_sheet_next_cell_struct
:How to use
xlsxioread_debug_internals
:it prints internal structures with extracted number formats (just for debugging)
Output: