tdf#101135 FILESAVE .xlsx Save XML_outlineLevelRow, XML_outlineLevelCol keys
In .xlsx, the XML_outlineLevelRow and XML_outlineLevelCol keys are required for Microsoft Office365 application to properly displaying Outline values. Change-Id: If4184ddc4fbfaa409732ddb0fb4ca85b4a27b024
This commit is contained in:
committed by
Markus Mohrhard
parent
fed8226315
commit
ad121df71a
@@ -490,6 +490,11 @@ void ScExportTest::testOutlineExportXLSX()
|
||||
xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
|
||||
CPPUNIT_ASSERT(pSheet);
|
||||
|
||||
// Maximum Outline Row is 4 for this document
|
||||
assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "outlineLevelRow", "4");
|
||||
// Maximum Outline Column is 4 for this document
|
||||
assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "outlineLevelCol", "4");
|
||||
|
||||
// First XML node, creates two columns (from min=1 to max=2)
|
||||
assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false");
|
||||
assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "1");
|
||||
|
@@ -1669,7 +1669,8 @@ void XclExpColinfo::SaveXml( XclExpXmlStream& rStrm )
|
||||
XclExpColinfoBuffer::XclExpColinfoBuffer( const XclExpRoot& rRoot ) :
|
||||
XclExpRoot( rRoot ),
|
||||
maDefcolwidth( rRoot ),
|
||||
maOutlineBfr( rRoot )
|
||||
maOutlineBfr( rRoot ),
|
||||
maHighestOutlineLevel( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1677,7 +1678,13 @@ void XclExpColinfoBuffer::Initialize( SCROW nLastScRow )
|
||||
{
|
||||
|
||||
for( sal_uInt16 nScCol = 0, nLastScCol = GetMaxPos().Col(); nScCol <= nLastScCol; ++nScCol )
|
||||
{
|
||||
maColInfos.AppendNewRecord( new XclExpColinfo( GetRoot(), nScCol, nLastScRow, maOutlineBfr ) );
|
||||
if( maOutlineBfr.GetLevel() > maHighestOutlineLevel )
|
||||
{
|
||||
maHighestOutlineLevel = maOutlineBfr.GetLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void XclExpColinfoBuffer::Finalize( ScfUInt16Vec& rXFIndexes )
|
||||
@@ -2094,7 +2101,8 @@ void XclExpRow::SaveXml( XclExpXmlStream& rStrm )
|
||||
XclExpRowBuffer::XclExpRowBuffer( const XclExpRoot& rRoot ) :
|
||||
XclExpRoot( rRoot ),
|
||||
maOutlineBfr( rRoot ),
|
||||
maDimensions( rRoot )
|
||||
maDimensions( rRoot ),
|
||||
maHighestOutlineLevel( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2343,6 +2351,10 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 nXclRow, bool bRowAlwaysE
|
||||
( maOutlineBfr.GetLevel() != 0 ) ||
|
||||
( rDoc.RowHidden(nFrom, nScTab) ) )
|
||||
{
|
||||
if( maOutlineBfr.GetLevel() > maHighestOutlineLevel )
|
||||
{
|
||||
maHighestOutlineLevel = maOutlineBfr.GetLevel();
|
||||
}
|
||||
RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, bRowAlwaysEmpty));
|
||||
maRowMap.insert(RowMap::value_type(nFrom, p));
|
||||
}
|
||||
@@ -2627,7 +2639,16 @@ void XclExpCellTable::SaveXml( XclExpXmlStream& rStrm )
|
||||
XclExpDefaultRowData& rDefData = mxDefrowheight->GetDefaultData();
|
||||
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
|
||||
rWorksheet->startElement( XML_sheetFormatPr,
|
||||
XML_defaultRowHeight, OString::number( (double) rDefData.mnHeight / 20.0 ).getStr(), FSEND );
|
||||
// OOXTODO: XML_baseColWidth
|
||||
// OOXTODO: XML_defaultColWidth
|
||||
// OOXTODO: XML_customHeight
|
||||
// OOXTODO: XML_zeroHeight
|
||||
// OOXTODO: XML_thickTop
|
||||
// OOXTODO: XML_thickBottom
|
||||
XML_defaultRowHeight, OString::number( static_cast< double> ( rDefData.mnHeight ) / 20.0 ).getStr(),
|
||||
XML_outlineLevelRow, OString::number( maRowBfr.GetHighestOutlineLevel() ).getStr(),
|
||||
XML_outlineLevelCol, OString::number( maColInfoBfr.GetHighestOutlineLevel() ).getStr(),
|
||||
FSEND );
|
||||
rWorksheet->endElement( XML_sheetFormatPr );
|
||||
|
||||
maColInfoBfr.SaveXml( rStrm );
|
||||
|
@@ -770,6 +770,7 @@ public:
|
||||
/** Writes all COLINFO records of this buffer. */
|
||||
virtual void Save( XclExpStream& rStrm ) override;
|
||||
virtual void SaveXml( XclExpXmlStream& rStrm ) override;
|
||||
sal_uInt8 GetHighestOutlineLevel() { return maHighestOutlineLevel; }
|
||||
|
||||
private:
|
||||
typedef XclExpRecordList< XclExpColinfo > XclExpColinfoList;
|
||||
@@ -778,6 +779,7 @@ private:
|
||||
XclExpColinfoList maColInfos; /// List of COLINFO records.
|
||||
XclExpDefcolwidth maDefcolwidth; /// The DEFCOLWIDTH record.
|
||||
XclExpColOutlineBuffer maOutlineBfr; /// Buffer for column outline groups.
|
||||
sal_uInt8 maHighestOutlineLevel; /// Highest number of outline levels for columns in sheet.
|
||||
};
|
||||
|
||||
class XclExpRow;
|
||||
@@ -928,7 +930,8 @@ public:
|
||||
virtual void Save( XclExpStream& rStrm ) override;
|
||||
virtual void SaveXml( XclExpXmlStream& rStrm ) override;
|
||||
|
||||
XclExpDimensions& GetDimensions() { return maDimensions;}
|
||||
XclExpDimensions& GetDimensions() { return maDimensions; }
|
||||
sal_uInt8 GetHighestOutlineLevel() { return maHighestOutlineLevel; }
|
||||
|
||||
private:
|
||||
/** Returns access to the specified ROW record. Inserts preceding missing ROW records.
|
||||
@@ -943,6 +946,7 @@ private:
|
||||
RowMap maRowMap;
|
||||
XclExpRowOutlineBuffer maOutlineBfr; /// Buffer for row outline groups.
|
||||
XclExpDimensions maDimensions; /// DIMENSIONS record for used area.
|
||||
sal_uInt8 maHighestOutlineLevel; /// Highest number of outline levels for rows in sheet.
|
||||
};
|
||||
|
||||
// Cell Table
|
||||
|
@@ -518,6 +518,11 @@ void WorksheetFragment::importSheetFormatPr( const AttributeList& rAttribs )
|
||||
setBaseColumnWidth( rAttribs.getInteger( XML_baseColWidth, 8 ) );
|
||||
setDefaultColumnWidth( rAttribs.getDouble( XML_defaultColWidth, 0.0 ) );
|
||||
// default row settings
|
||||
|
||||
// We don't need to import:
|
||||
// XML_outlineLevelRow
|
||||
// XML_outlineLevelCol
|
||||
// as it will be updated during export to OOXML
|
||||
setDefaultRowSettings(
|
||||
rAttribs.getDouble( XML_defaultRowHeight, 0.0 ),
|
||||
rAttribs.getBool( XML_customHeight, false ),
|
||||
|
Reference in New Issue
Block a user