Closed sukoi26 closed 3 years ago
question about this code in consummer.cpp
expect_start_element(qn("spreadsheetml", "xf"), xml::content::complex);
auto &record = *(!in_style_records
? format_records.emplace(format_records.end())
: style_records.emplace(style_records.end()));
v.emplace(v.end()) does it copy of the last record ? value initialization?
i come back on this issue ,segfault disappear if i change the flag "garbage_collection_enabled" to false. I change the test file like below the result the fill is applied on cell not requested AA = green BB= red CC=blue as you see. i check2 the origin file result i have 5 fills OK I check2 the origin xfs
<cellXfs count="5">
<xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyFont="false" applyBorder="false" applyAlignment="false" applyProtection="false">
<alignment horizontal="general" vertical="bottom" textRotation="0" wrapText="false" indent="0" shrinkToFit="false"/>
<protection locked="true" hidden="false"/>
</xf>
<xf numFmtId="164" fontId="4" fillId="0" borderId="1" xfId="0" applyFont="true" applyBorder="true" applyAlignment="true" applyProtection="false">
<alignment horizontal="center" vertical="bottom" textRotation="0" wrapText="false" indent="0" shrinkToFit="false"/>
<protection locked="true" hidden="false"/>
</xf>
<xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false">
<alignment horizontal="general" vertical="bottom" textRotation="0" wrapText="false" indent="0" shrinkToFit="false"/>
<protection locked="true" hidden="false"/>
</xf>
<xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="17" applyFont="true" applyBorder="true" applyAlignment="true" applyProtection="true">
<alignment horizontal="center" vertical="center" textRotation="0" wrapText="false" indent="0" shrinkToFit="false"/>
<protection locked="true" hidden="false"/>
</xf>
<xf numFmtId="164" fontId="4" fillId="0" borderId="0" xfId="0" applyFont="true" applyBorder="true" applyAlignment="true" applyProtection="false">
<alignment horizontal="left" vertical="center" textRotation="0" wrapText="false" indent="0" shrinkToFit="false"/>
<protection locked="true" hidden="false"/>
</xf>
</cellXfs>
and the result
<cellXfs count="6">
<xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyFont="0" applyBorder="0" applyAlignment="0" applyProtection="0">
<alignment horizontal="general" vertical="bottom" textRotation="0" indent="0"/>
<protection locked="1" hidden="0"/>
</xf>
<xf numFmtId="164" fontId="2" fillId="0" borderId="1" xfId="0" applyFont="1" applyBorder="1" applyAlignment="1" applyProtection="0">
<alignment horizontal="center" vertical="bottom" textRotation="0" indent="0"/>
<protection locked="1" hidden="0"/>
</xf>
<xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyFont="1" applyBorder="0" applyAlignment="0" applyProtection="0">
<alignment horizontal="general" vertical="bottom" textRotation="0" indent="0"/>
<protection locked="1" hidden="0"/>
</xf>
<xf numFmtId="164" fontId="0" fillId="2" borderId="0" xfId="3" applyFill="1" applyFont="1" applyBorder="1" applyAlignment="1" applyProtection="1">
<alignment horizontal="center" vertical="center" textRotation="0" indent="0"/>
<protection locked="1" hidden="0"/>
</xf>
<xf fillId="3" applyFill="1"/>
<xf fillId="4" applyFill="1"/>
</cellXfs>
change add 3 fills but the xfs count increase only +1 (5->6) ??? if cell row 3 , 5, 6
<row r="4" customFormat="false" ht="12.8" hidden="false" customHeight="false" outlineLevel="0" collapsed="false">
<c r="A4" s="4"/>
<c r="B4" s="2" t="s">
<v>8</v>
</c>
<c r="C4" s="3"/>
<c r="D4" s="2" t="s">
<v>7</v>
</c>
</row>
<row r="5" customFormat="false" ht="12.8" hidden="false" customHeight="false" outlineLevel="0" collapsed="false">
<c r="A5" s="4"/>
<c r="B5" s="2" t="s">
<v>9</v>
</c>
<c r="C5" s="3"/>
<c r="D5" s="2" t="s">
<v>7</v>
</c>
</row>
<row r="6" customFormat="false" ht="12.8" hidden="false" customHeight="false" outlineLevel="0" collapsed="false">
<c r="A6" s="4"/>
<c r="B6" s="2" t="s">
<v>10</v>
</c>
<c r="C6" s="3"/>
<c r="D6" s="2" t="s">
<v>7</v>
</c>
</row>
result
<row r="4" spans="1:4" customFormat="0" ht="12.8">
<c r="A4" s="4"/>
<c r="B4" s="2" t="s">
<v>8</v>
</c>
<c r="C4" s="5"/>
<c r="D4" s="2" t="s">
<v>7</v>
</c>
</row>
<row r="5" spans="1:4" customFormat="0" ht="12.8">
<c r="A5" s="4"/>
<c r="B5" s="2" t="s">
<v>9</v>
</c>
<c r="C5" s="4"/>
<c r="D5" s="2" t="s">
<v>7</v>
</c>
</row>
<row r="6" spans="1:4" customFormat="0" ht="12.8">
<c r="A6" s="4"/>
<c r="B6" s="2" t="s">
<v>10</v>
</c>
<c r="C6" s="5"/>
<c r="D6" s="2" t="s">
<v>7</v>
</c>
</row>
note the style row (3,4,5,6) between 2 files A / C A / C 3 2 / 3 2 / 3 4 4 / 3 4 / 5 5 4 / 3 4 / 4 6 4 / 3 4 / 5
3 = green 4 = blue 5 =red a)when i create format style , the cell change only if i change the fill, as the new cellxfs, but in case no change i use the modified cellXfs with different style? b) row 6 ,cell C why the style is changed no color applied (DD) c)row 7 cell A no fill as the origin file has no A7 applied style
files joined: COPY_noname.xlsx noname.xlsx
i locate the issue :
void xlsx_consumer::read_worksheet_sheetdata()
...
// test
//if (cell.style_index != -1)
//{
// ws_cellimpl->format = target_.format(static_cast
to solve this case , but with an other test file still a problem (infinite loop) IMPORTANT: EXCEL give dimension with lot of "holes", XLNT is no optimized for that
<dimension ref="A1:AMJ1048576"/>
<c r="D1" s="8" t="s">
<v>3</v>
</c>
<c r="YD1" s="0"/>
now cellXfs is 8 ( 5 + 3)
the target format is ok for this case but existing styles are not set
previous comment is not exact as the existing format not set. So i locate other thing on the stylesheet commit 617f7a2525fe20133b77241162e5ea5ed48222af very different of now
as this code is complex due garbage, i only comment the line 403 to solve the problem //iter->references -= iter->references > 0 ? 1 : 0; it seems the pattern id is not increase when i create the first fill
currently on test with other file , if someboby can try ... th+
i close the issue as i cannot reproduce it on Linux with the latest commit of january https://github.com/tfussell/xlnt/commit/e66e417b0c8806121202adb2dc45de91809710cc .
I had no problem with this attached example, but now I have a segfault
the test : the program compares a chain and fills the cell in the adjacent if equal column.
behavior observed: the first row is ok, at the second for fillr, a segfault on the function
format_impl * find_or_create_with (format_impl * pattern, const fill & new_fill, optional <bool> applied)
some code to change
the file BATSV4.xlsx
GDB (linux)