Open-XML-SDK: Element classes do not contain all child element-related properties
Description
The DocumentFormat.OpenXml.Spreadsheet.Worksheet
class only has properties for 4 out of 38 child elements. For example, there is no property for the only mandatory child element, x:sheetData
, which is likely among the most frequently referenced elements.
As per the schema, those child elements have to be in a defined order, which, in the absence of SDK support, needs to be ensured by the caller’s code. That increases the size and complexity of the code.
Information
- .NET Target: all
- DocumentFormat.OpenXml Version: 3cc26570f2964a5d56a5988f9464b2e4b29812c7
Observed
The Worksheet
class defines the following child elements:
[ChildElementInfo(typeof(SheetProperties))]
[ChildElementInfo(typeof(SheetDimension))]
[ChildElementInfo(typeof(SheetViews))]
[ChildElementInfo(typeof(SheetFormatProperties))]
[ChildElementInfo(typeof(Columns))]
[ChildElementInfo(typeof(SheetData))]
[ChildElementInfo(typeof(SheetCalculationProperties))]
[ChildElementInfo(typeof(SheetProtection))]
[ChildElementInfo(typeof(ProtectedRanges))]
[ChildElementInfo(typeof(Scenarios))]
[ChildElementInfo(typeof(AutoFilter))]
[ChildElementInfo(typeof(SortState))]
[ChildElementInfo(typeof(DataConsolidate))]
[ChildElementInfo(typeof(CustomSheetViews))]
[ChildElementInfo(typeof(MergeCells))]
[ChildElementInfo(typeof(PhoneticProperties))]
[ChildElementInfo(typeof(ConditionalFormatting))]
[ChildElementInfo(typeof(DataValidations))]
[ChildElementInfo(typeof(Hyperlinks))]
[ChildElementInfo(typeof(PrintOptions))]
[ChildElementInfo(typeof(PageMargins))]
[ChildElementInfo(typeof(PageSetup))]
[ChildElementInfo(typeof(HeaderFooter))]
[ChildElementInfo(typeof(RowBreaks))]
[ChildElementInfo(typeof(ColumnBreaks))]
[ChildElementInfo(typeof(CustomProperties))]
[ChildElementInfo(typeof(CellWatches))]
[ChildElementInfo(typeof(IgnoredErrors))]
[ChildElementInfo(typeof(Drawing))]
[ChildElementInfo(typeof(LegacyDrawing))]
[ChildElementInfo(typeof(LegacyDrawingHeaderFooter))]
[ChildElementInfo(typeof(DrawingHeaderFooter))]
[ChildElementInfo(typeof(Picture))]
[ChildElementInfo(typeof(OleObjects))]
[ChildElementInfo(typeof(Controls))]
[ChildElementInfo(typeof(WebPublishItems))]
[ChildElementInfo(typeof(TableParts))]
[ChildElementInfo(typeof(WorksheetExtensionList))]
However, the Worksheet
class only provides the following properties:
/// <summary>
/// <para> SheetProperties.</para>
/// <para> Represents the following element tag in the schema: x:sheetPr </para>
/// </summary>
/// <remark>
/// xmlns:x = http://schemas.openxmlformats.org/spreadsheetml/2006/main
/// </remark>
public SheetProperties SheetProperties
{
get => GetElement<SheetProperties>(0);
set => SetElement(0, value);
}
/// <summary>
/// <para> SheetDimension.</para>
/// <para> Represents the following element tag in the schema: x:dimension </para>
/// </summary>
/// <remark>
/// xmlns:x = http://schemas.openxmlformats.org/spreadsheetml/2006/main
/// </remark>
public SheetDimension SheetDimension
{
get => GetElement<SheetDimension>(1);
set => SetElement(1, value);
}
/// <summary>
/// <para> SheetViews.</para>
/// <para> Represents the following element tag in the schema: x:sheetViews </para>
/// </summary>
/// <remark>
/// xmlns:x = http://schemas.openxmlformats.org/spreadsheetml/2006/main
/// </remark>
public SheetViews SheetViews
{
get => GetElement<SheetViews>(2);
set => SetElement(2, value);
}
/// <summary>
/// <para> SheetFormatProperties.</para>
/// <para> Represents the following element tag in the schema: x:sheetFormatPr </para>
/// </summary>
/// <remark>
/// xmlns:x = http://schemas.openxmlformats.org/spreadsheetml/2006/main
/// </remark>
public SheetFormatProperties SheetFormatProperties
{
get => GetElement<SheetFormatProperties>(3);
set => SetElement(3, value);
}
Expected
Given that the child elements must be in a defined order, the Worksheet
class defines properties for all child elements.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 17 (8 by maintainers)
@twsouthwick, just checking whether this issue is still open. Otherwise, we might want to close it.