Skip to content

Commit 52602f9

Browse files
Merge pull request 'fix bug #73437' (#247) from fix/bug73437 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/247
2 parents bd838da + 9cde3dc commit 52602f9

File tree

5 files changed

+45
-26
lines changed

5 files changed

+45
-26
lines changed

MsBinaryFile/XlsFile/Format/Logic/Biff_structures/StringPtgParser.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,6 @@ const bool StringPtgParser::parseToPtgs(const std::wstring& assembled_formula, R
317317
[&](XLS::GlobalWorkbookInfo::_xti i) {
318318
return i.iSup == ixti;
319319
});
320-
if(pos->itabFirst == pos->itabLast)
321-
rgce.addPtg(found_operand = OperandPtgPtr(new PtgRef3d(ixti, operand_str, OperandPtg::ptg_VALUE, rgce.getLocation())));
322-
else
323320
rgce.addPtg(found_operand = OperandPtgPtr(new PtgRef3d(ixti, operand_str, OperandPtg::ptg_REFERENCE, rgce.getLocation())));
324321
}
325322
else if(SyntaxPtg::extract_PtgRefErr(it, itEnd))

OOXML/Binary/Sheets/Reader/BinaryWriter.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -2663,6 +2663,9 @@ void BinaryWorkbookTableWriter::WritePivotCache(OOX::Spreadsheet::CWorkbook& wor
26632663
{
26642664
nCurPos = m_oBcw.WriteItemStart(c_oSer_PivotTypes::cache);
26652665
NSStringUtils::CStringBuilder writer;
2666+
writer.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
2667+
if(pivotCacheFile->m_oPivotCashDefinition->m_oRid.IsInit())
2668+
pivotCacheFile->m_oPivotCashDefinition->m_oRid.reset();
26662669
pivotCacheFile->m_oPivotCashDefinition->toXML(writer);
26672670
auto wstringData = writer.GetData();
26682671
m_oBcw.m_oStream.WriteStringUtf8(wstringData);

OOXML/Binary/Sheets/Writer/BinaryReader.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3493,7 +3493,7 @@ int BinaryWorkbookTableReader::ReadPivotCaches(BYTE type, long length, void* poR
34933493
NSCommon::smart_ptr<OOX::File> pFileRecords(oPivotCachesTemp.pRecords);
34943494
srIdRecords = pDefinitionFile->Add(pFileRecords).ToString();
34953495
}
3496-
pDefinitionFile->setData(oPivotCachesTemp.pDefinitionData, oPivotCachesTemp.nDefinitionLength, L"");
3496+
pDefinitionFile->setData(oPivotCachesTemp.pDefinitionData, oPivotCachesTemp.nDefinitionLength, srIdRecords);
34973497

34983498
NSCommon::smart_ptr<OOX::File> pFile(pDefinitionFile);
34993499
OOX::RId rIdDefinition = m_oWorkbook.Add(pFile);

OOXML/XlsbFormat/Biff12_records/BeginSXPI.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ namespace XLSB
5151
void readFields(XLS::CFRecord& record) override;
5252
void writeFields(XLS::CFRecord& record) override;
5353

54-
_INT32 isxvd;
55-
_UINT32 isxvi;
56-
_INT32 isxth;
57-
bool fUnique;
58-
bool fDisplay;
54+
_INT32 isxvd = 0;
55+
_UINT32 isxvi = 0x001000FE;
56+
_INT32 isxth = -1;
57+
bool fUnique = false;
58+
bool fDisplay = false;
5959
XLWideString irstUnique;
6060
XLWideString irstDisplay;
6161
};

OOXML/XlsxFormat/Pivot/Pivots.cpp

+36-17
Original file line numberDiff line numberDiff line change
@@ -1885,13 +1885,15 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
18851885
if(m_oHier.IsInit())
18861886
ptr->isxth = m_oHier.get();
18871887
if(m_oName.IsInit())
1888+
{
18881889
ptr->irstUnique = m_oName.get();
1889-
else
1890-
ptr->irstUnique = 0xFFFFFFFF;
1890+
ptr->fUnique = true;
1891+
}
18911892
if(m_oCap.IsInit())
1893+
{
18921894
ptr->irstDisplay = m_oCap.get();
1893-
else
1894-
ptr->irstDisplay = 0xFFFFFFFF;
1895+
ptr->fDisplay = true;
1896+
}
18951897
return objectPtr;
18961898
}
18971899
void CPageField::fromBin(XLS::BaseObjectPtr& obj)
@@ -4172,7 +4174,6 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
41724174
writer.WriteString(L"<cacheField");
41734175
WritingStringNullableAttrEncodeXmlString2(L"name", m_oName);
41744176
WritingStringNullableAttrEncodeXmlString2(L"caption",m_oCaption);
4175-
WritingStringNullableAttrBool2(L"databaseField", m_oDatabaseField);
41764177
WritingStringNullableAttrBool2(L"serverField", m_oServerField);
41774178
WritingStringNullableAttrEncodeXmlString2(L"pPropertyName",m_oPropertyName);
41784179
WritingStringNullableAttrEncodeXmlString2(L"formula",m_oFormula);
@@ -4183,6 +4184,7 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
41834184
WritingStringNullableAttrInt(L"level", m_oLevel, m_oLevel->GetValue());
41844185
WritingStringNullableAttrInt(L"mappingCount", m_oMappingCount, m_oMappingCount->GetValue());
41854186
WritingStringNullableAttrInt(L"numFmtId", m_oNumFmtId, m_oNumFmtId->GetValue());
4187+
WritingStringNullableAttrBool2(L"databaseField", m_oDatabaseField);
41864188
if(!m_oSharedItems.IsInit() && !m_oFieldGroup.IsInit())
41874189
{
41884190
writer.WriteString(L"/>");
@@ -4406,22 +4408,29 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
44064408
void CSharedItems::toXML(NSStringUtils::CStringBuilder& writer) const
44074409
{
44084410
writer.WriteString(L"<sharedItems");
4409-
WritingStringAttrInt(L"count", (int)m_arrItems.size());
4411+
WritingStringNullableAttrBool2(L"containsSemiMixedTypes", m_oContainsSemiMixedTypes);
4412+
WritingStringNullableAttrBool2(L"containsNonDate", m_oContainsNonDate);
4413+
WritingStringNullableAttrBool2(L"containsDate", m_oContainsDate);
4414+
WritingStringNullableAttrBool2(L"containsString", m_oContainsString);
44104415
WritingStringNullableAttrBool2(L"containsBlank", m_oContainsBlank);
4411-
WritingStringNullableAttrBool2(L"containsDate", m_oContainsDate);
4416+
WritingStringNullableAttrBool2(L"containsMixedTypes", m_oContainsMixedTypes);
4417+
WritingStringNullableAttrBool2(L"containsNumber", m_oContainsNumber);
44124418
WritingStringNullableAttrBool2(L"containsInteger", m_oContainsInteger);
4413-
WritingStringNullableAttrBool2(L"containsMixedTypes", m_oContainsMixedTypes);
4414-
WritingStringNullableAttrBool2(L"containsNonDate", m_oContainsNonDate);
4415-
WritingStringNullableAttrBool2(L"containsNumber", m_oContainsNumber);
4416-
WritingStringNullableAttrBool2(L"containsSemiMixedTypes", m_oContainsSemiMixedTypes);
4417-
WritingStringNullableAttrBool2(L"containsString", m_oContainsString);
4418-
WritingStringNullableAttrBool2(L"longText", m_oLongText);
44194419
WritingStringNullableAttrDouble2(L"minValue", m_oMinValue);
44204420
WritingStringNullableAttrDouble2(L"maxValue", m_oMaxValue);
44214421
WritingStringNullableAttrString(L"minDate", m_oMinDate, m_oMinDate->ToString());
44224422
WritingStringNullableAttrString(L"maxDate", m_oMaxDate, m_oMaxDate->ToString());
4423-
writer.WriteString(L">");
4424-
4423+
if(!m_arrItems.empty())
4424+
{
4425+
WritingStringAttrInt(L"count", (int)m_arrItems.size());
4426+
}
4427+
WritingStringNullableAttrBool2(L"longText", m_oLongText);
4428+
if(m_arrItems.empty())
4429+
{
4430+
writer.WriteString(L"/>");
4431+
return;
4432+
}
4433+
writer.WriteString(L">");
44254434
for ( size_t i = 0; i < m_arrItems.size(); ++i)
44264435
{
44274436
if ( m_arrItems[i] )
@@ -5127,7 +5136,7 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
51275136
//------------------------------------
51285137
void CRangeGroupingProperties::toXML(NSStringUtils::CStringBuilder& writer) const
51295138
{
5130-
writer.WriteString(L"<reference");
5139+
writer.WriteString(L"<rangePr");
51315140
WritingStringNullableAttrString(L"groupBy", m_oGroupBy, m_oGroupBy->ToString());
51325141
WritingStringNullableAttrBool2(L"autoStart", m_oAutoStart);
51335142
WritingStringNullableAttrBool2(L"autoEnd", m_oAutoEnd);
@@ -5835,6 +5844,11 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
58355844
}
58365845
WritingStringNullableAttrBool2(L"f", m_oCalculated);
58375846
WritingStringNullableAttrBool2(L"u", m_oUnused);
5847+
if(m_arrItems.empty())
5848+
{
5849+
writer.WriteString(L"/>");
5850+
return;
5851+
}
58385852
writer.WriteString(L">");
58395853

58405854
for ( size_t i = 0; i < m_arrItems.size(); ++i)
@@ -5967,6 +5981,11 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
59675981
}
59685982
WritingStringNullableAttrBool2(L"f", m_oCalculated);
59695983
WritingStringNullableAttrBool2(L"u", m_oUnused);
5984+
if(m_arrItems.empty())
5985+
{
5986+
writer.WriteString(L"/>");
5987+
return;
5988+
}
59705989
writer.WriteString(L">");
59715990

59725991
for ( size_t i = 0; i < m_arrItems.size(); ++i)
@@ -6864,8 +6883,8 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
68646883
void CFieldGroupProperties::toXML(NSStringUtils::CStringBuilder& writer) const
68656884
{
68666885
writer.WriteString(L"<fieldGroup");
6867-
WritingStringNullableAttrInt(L"base", m_oBase, m_oBase->GetValue());
68686886
WritingStringNullableAttrInt(L"par", m_oPar, m_oPar->GetValue());
6887+
WritingStringNullableAttrInt(L"base", m_oBase, m_oBase->GetValue());
68696888
writer.WriteString(L">");
68706889

68716890
if(m_oDiscretePr.IsInit())

0 commit comments

Comments
 (0)