mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Merge pull request #646 from tfussell/fix-unhandled-values-in-switch
Fix unhandled enumeration values in switch statement
This commit is contained in:
commit
69a20f3627
|
@ -672,14 +672,22 @@ void xlsx_producer::write_workbook(const relationship &rel)
|
||||||
|
|
||||||
for (const auto &child_rel : workbook_rels)
|
for (const auto &child_rel : workbook_rels)
|
||||||
{
|
{
|
||||||
if (child_rel.type() == relationship_type::calculation_chain) continue;
|
if (child_rel.type() == relationship_type::calculation_chain)
|
||||||
|
{
|
||||||
|
// We don't yet have a VBA interpreter which can evaluate formulas.
|
||||||
|
// If we write an outdated calculate chain, Excel will treat the XLSX
|
||||||
|
// as corrupt. As a workaround, we keep the relationship but don't
|
||||||
|
// write the calculation chain file so Excel will recalculate all formulae
|
||||||
|
// on load.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
path archive_path(child_rel.source().path().parent().append(child_rel.target().path()));
|
auto child_target_path = child_rel.target().path();
|
||||||
|
path archive_path(child_rel.source().path().parent().append(child_target_path));
|
||||||
|
|
||||||
// write binary
|
// write binary
|
||||||
switch (child_rel.type())
|
if (child_rel.type() == relationship_type::vbaproject)
|
||||||
{
|
{
|
||||||
case relationship_type::vbaproject:
|
|
||||||
write_binary(archive_path);
|
write_binary(archive_path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -3071,9 +3079,9 @@ void xlsx_producer::write_worksheet(const relationship &rel)
|
||||||
if (child_rel.type() == relationship_type::printer_settings)
|
if (child_rel.type() == relationship_type::printer_settings)
|
||||||
{
|
{
|
||||||
write_binary(archive_path);
|
write_binary(archive_path);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
begin_part(archive_path);
|
begin_part(archive_path);
|
||||||
|
|
||||||
if (child_rel.type() == relationship_type::comments)
|
if (child_rel.type() == relationship_type::comments)
|
||||||
|
@ -3090,7 +3098,6 @@ void xlsx_producer::write_worksheet(const relationship &rel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sheet Relationship Target Parts
|
// Sheet Relationship Target Parts
|
||||||
|
|
Loading…
Reference in New Issue
Block a user