[x2t] Add numformat formatCode16 for bug 48273

This commit is contained in:
Sergey Konovalov
2022-05-10 11:02:35 +03:00
parent ec8fa5d6cc
commit 4f4a3cc8fa
4 changed files with 19 additions and 1 deletions

View File

@ -72,6 +72,7 @@ namespace OOX
writer.StartAttributes();
WritingStringNullableAttrInt(L"numFmtId", m_oNumFmtId, m_oNumFmtId->GetValue());
WritingStringNullableAttrEncodeXmlString(L"formatCode", m_oFormatCode, *m_oFormatCode);
WritingStringNullableAttrEncodeXmlString(L"x16r2:formatCode16", m_oFormatCode16, *m_oFormatCode16);
WritingStringNullableAttrBool(L"sourceLinked", m_oSourceLinked);
writer.EndAttributesAndNode();
}
@ -98,6 +99,7 @@ namespace OOX
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("formatCode"), m_oFormatCode )
WritingElement_ReadAttributes_Read_if ( oReader, _T("x16r2:formatCode16"), m_oFormatCode16 )
WritingElement_ReadAttributes_Read_if ( oReader, _T("numFmtId"), m_oNumFmtId )
WritingElement_ReadAttributes_Read_if ( oReader, _T("sourceLinked"), m_oSourceLinked )
@ -117,6 +119,7 @@ namespace OOX
public:
nullable_string m_oFormatCode;
nullable_string m_oFormatCode16;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oNumFmtId;
nullable<SimpleTypes::COnOff<>> m_oSourceLinked;
};

View File

@ -195,7 +195,8 @@ namespace BinXlsxRW
namespace c_oSerNumFmtTypes{enum c_oSerNumFmtTypes
{
FormatCode = 0,
NumFmtId = 1
NumFmtId = 1,
FormatCode16 = 2
};}
namespace c_oSerSharedStringTypes{enum c_oSerSharedStringTypes
{

View File

@ -1663,6 +1663,16 @@ void BinaryStyleTableWriter::WriteNumFmt(const OOX::Spreadsheet::CNumFmt& numFmt
if(NULL != m_pEmbeddedFontsManager)
m_pEmbeddedFontsManager->CheckString(sFormatCode);
}
if(numFmt.m_oFormatCode16.IsInit())
{
std::wstring& sFormatCode = *numFmt.m_oFormatCode16;
m_oBcw.m_oStream.WriteBYTE(c_oSerNumFmtTypes::FormatCode16);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
m_oBcw.m_oStream.WriteStringW(sFormatCode);
if(NULL != m_pEmbeddedFontsManager)
m_pEmbeddedFontsManager->CheckString(sFormatCode);
}
//NumFmtId
if(numFmt.m_oNumFmtId.IsInit())
{

View File

@ -1672,6 +1672,10 @@ int BinaryStyleTableReader::ReadNumFmt(BYTE type, long length, void* poResult)
{
pNumFmt->m_oFormatCode = m_oBufferedStream.GetString4(length);
}
else if(c_oSerNumFmtTypes::FormatCode16 == type)
{
pNumFmt->m_oFormatCode16 = m_oBufferedStream.GetString4(length);
}
else if(c_oSerNumFmtTypes::NumFmtId == type)
{
pNumFmt->m_oNumFmtId.Init();