diff --git a/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.cpp b/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.cpp index 1a411253d7..939da2f4e5 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.cpp +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.cpp @@ -212,7 +212,7 @@ namespace OOX } return nLen; } - _UINT16 CFormulaXLSB::toXLSB(NSBinPptxRW::CXlsbBinaryWriter& oStream) + _UINT16 CFormulaXLSB::toXLSB(NSBinPptxRW::CXlsbBinaryWriter& oStream, bool bIsBlankFormula) { _UINT16 nFlags = 0; if(m_oCa.ToBool()) @@ -266,6 +266,10 @@ namespace OOX { nFlagsExt |= 0x1000; } + if(bIsBlankFormula) + { + nFlagsExt |= 0x4000; + } return nFlagsExt; } void CFormulaXLSB::toXLSBExt(NSBinPptxRW::CXlsbBinaryWriter& oStream) @@ -369,9 +373,11 @@ namespace OOX case SimpleTypes::Spreadsheet::celltypeStr: nType = XLSB::rt_CELL_ST; break; } } + bool bIsBlankFormula = false; if(XLSB::rt_CELL_BLANK == nType && bWriteFormula) { nType = XLSB::rt_CELL_ST; + bIsBlankFormula = true; } _UINT32 nLen = 4+4+2; @@ -446,7 +452,7 @@ namespace OOX _UINT16 nFlags = 0; if(bWriteFormula) { - nFlags = m_oFormula.toXLSB(oStream); + nFlags = m_oFormula.toXLSB(oStream, bIsBlankFormula); } if(m_oRichText.IsInit()) @@ -990,6 +996,11 @@ namespace OOX m_oFormula.Init(); } m_oFormula->fromXLSBExt(oStream, nFlags); + if(0 != (nFlags & 0x4000)) + { + m_oType.reset(NULL); + m_oValue.reset(NULL); + } } if(0 != (nFlags & 0x2000)) { diff --git a/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.h b/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.h index f7179bb63a..1f0d0b8028 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.h +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.h @@ -62,7 +62,7 @@ namespace OOX void Clean(); void fromXML(XmlUtils::CXmlLiteReader& oReader); _UINT32 getXLSBSize() const; - _UINT16 toXLSB(NSBinPptxRW::CXlsbBinaryWriter& oStream); + _UINT16 toXLSB(NSBinPptxRW::CXlsbBinaryWriter& oStream, bool bIsBlankFormula); void toXLSBExt(NSBinPptxRW::CXlsbBinaryWriter& oStream); public: bool m_bIsInit;