mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-20 00:03:33 +08:00
Fix cfvo formula conversion
This commit is contained in:
@ -81,6 +81,7 @@ void FRTParsedFormula::save(XLS::CFRecord& record)
|
||||
record.RollRdPtrBack(cce + 8);
|
||||
record << cce;
|
||||
record.skipNunBytes(cce + 4);
|
||||
this->cce = cce;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -104,6 +104,12 @@ namespace XLSB
|
||||
|
||||
record << flags;
|
||||
|
||||
if(cbFmla1 > 0 && !FRTheader.rgFormulas.array.empty())
|
||||
cbFmla1 = FRTheader.rgFormulas.array.at(0).formula.cce;
|
||||
else if(cbFmla3 > 0 && !FRTheader.rgFormulas.array.empty())
|
||||
cbFmla3 = FRTheader.rgFormulas.array.at(0).formula.cce;
|
||||
if(cbFmla2 > 0 && FRTheader.rgFormulas.array.size() > 1)
|
||||
cbFmla2 = FRTheader.rgFormulas.array.at(1).formula.cce;
|
||||
record << cbFmla1 << cbFmla2 << cbFmla3;
|
||||
|
||||
record.reserveNunBytes(4);
|
||||
|
||||
@ -278,6 +278,12 @@ XLS::BaseObjectPtr CConditionalFormatValueObject::toBin(bool isIcon)
|
||||
if(static_cast<_UINT32>(ptr1->iType) == XLSB::CFVOtype::CFVOFMLA && m_oVal.IsInit())
|
||||
{
|
||||
ptr1->formula = m_oVal.get();
|
||||
auto lastValType = GETBITS(ptr1->formula.rgce.sequence.rbegin()->get()->ptg_id.get(),5,6);
|
||||
if(lastValType == 1 || lastValType == 3)
|
||||
{
|
||||
SETBITS(ptr1->formula.rgce.sequence.rbegin()->get()->ptg_id.get(),5,6,2);
|
||||
}
|
||||
|
||||
ptr1->cbFmla = 1;
|
||||
}
|
||||
else
|
||||
@ -2406,7 +2412,41 @@ XLS::BaseObjectPtr CConditionalFormattingRule::WriteAttributes14(const XLS::Cel
|
||||
}
|
||||
if(!ptr->FRTheader.rgFormulas.array.empty())
|
||||
ptr->FRTheader.fFormula = true;
|
||||
|
||||
if(m_oType == SimpleTypes::Spreadsheet::ECfType::colorScale || m_oType == SimpleTypes::Spreadsheet::ECfType::dataBar
|
||||
|| m_oType == SimpleTypes::Spreadsheet::ECfType::iconSet)
|
||||
ptr->cbFmla3 = 1;
|
||||
else
|
||||
ptr->cbFmla1 = 1;
|
||||
if(m_arrFormula.size() > 1)
|
||||
ptr->cbFmla2 = 1;
|
||||
}
|
||||
|
||||
if(!m_arrFormula.empty() && !m_arrFormula.front()->m_sText.empty())
|
||||
{
|
||||
ptr->cbFmla1 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr->cbFmla1 = 0;
|
||||
}
|
||||
if(!m_arrFormula.empty() && !m_arrFormula.front()->m_sText.empty())
|
||||
{
|
||||
ptr->cbFmla2 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr->cbFmla2 = 0;
|
||||
}
|
||||
if(!m_arrFormula.empty() && !m_arrFormula.front()->m_sText.empty())
|
||||
{
|
||||
ptr->cbFmla3 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr->cbFmla3 = 0;
|
||||
}
|
||||
|
||||
ptr->iType = XLSB::CFType::CF_TYPE_EXPRIS;
|
||||
ptr->iParam =0;
|
||||
ptr->iTemplate = XLSB::CFTemp::CF_TEMPLATE_EXPR;
|
||||
|
||||
Reference in New Issue
Block a user