diff --git a/Presentation/Components/2007/Table.cs b/Presentation/Components/2007/Table.cs index e7237c6d..4685f6fc 100644 --- a/Presentation/Components/2007/Table.cs +++ b/Presentation/Components/2007/Table.cs @@ -8,6 +8,7 @@ using G = OpenXMLOffice.Global_2007; using P = DocumentFormat.OpenXml.Presentation; using A16 = DocumentFormat.OpenXml.Office2016.Drawing; +using OpenXMLOffice.Global_2007; namespace OpenXMLOffice.Presentation_2007 { /// @@ -156,14 +157,14 @@ private A.TableGrid CreateTableGrid(int ColumnCount) { for (int i = 0; i < ColumnCount; i++) { - TableGrid.Append(new A.GridColumn(new A.ExtensionList(new A.Extension( new A16.ColIdIdentifier() { Val = (UInt32) (20000 + i) }) { Uri = "{9D8B030D-6E8A-4147-A177-3AD203B41FA5}" })) { Width = tableSetting.width / ColumnCount }); + TableGrid.Append(new A.GridColumn(new A.ExtensionList(new A.Extension(new A16.ColIdIdentifier() { Val = (UInt32)(20000 + i) }) { Uri = "{9D8B030D-6E8A-4147-A177-3AD203B41FA5}" })) { Width = tableSetting.width / ColumnCount }); } } else { for (int i = 0; i < ColumnCount; i++) { - TableGrid.Append(new A.GridColumn(new A.ExtensionList(new A.Extension( new A16.ColIdIdentifier() { Val = (UInt32) (20000 + i) }) { Uri = "{9D8B030D-6E8A-4147-A177-3AD203B41FA5}" })) { Width = CalculateColumnWidth(tableSetting.widthType, tableSetting.tableColumnWidth[i]) }); + TableGrid.Append(new A.GridColumn(new A.ExtensionList(new A.Extension(new A16.ColIdIdentifier() { Val = (UInt32)(20000 + i) }) { Uri = "{9D8B030D-6E8A-4147-A177-3AD203B41FA5}" })) { Width = CalculateColumnWidth(tableSetting.widthType, tableSetting.tableColumnWidth[i]) }); } } return TableGrid; @@ -176,15 +177,14 @@ private void AddMergeRange(int topLeftX, int topLeftY, int bottomRightX, int bot if (overlappingRanges.Any()) { - G.LogUtils.ShowWarning(string.Format("Warning: Table Merge Range Conflict: Found Overlap Range X:{0} Y:{1} cX:{2} cY:{3}", topLeftX, topLeftY, bottomRightX, bottomRightY)); + G.LogUtils.ShowWarning(string.Format("Warning: Table Merge Range Conflict: Found Overlap Range X:{0} Y:{1} cX:{2} cY:{3}", topLeftX, topLeftY, bottomRightX, bottomRightY)); G.LogUtils.ShowWarning("Rewriting the merge range"); // Merge the new range with the overlapping ranges int newTopLeftX = Math.Min(topLeftX, overlappingRanges.Min(range => range.topLeftX)); int newTopLeftY = Math.Min(topLeftY, overlappingRanges.Min(range => range.topLeftY)); int newBottomRightX = Math.Max(bottomRightX, overlappingRanges.Max(range => range.bottomRightX)); int newBottomRightY = Math.Max(bottomRightY, overlappingRanges.Max(range => range.bottomRightY)); - - G.LogUtils.ShowWarning(string.Format("Warning: Table Merge Range Conflict: Updating New Range X:{0} Y:{1} cX:{2} cY:{3}", newTopLeftX, newTopLeftY, newBottomRightX, newBottomRightY)); + G.LogUtils.ShowWarning(string.Format("Warning: Table Merge Range Conflict: Updating New Range X:{0} Y:{1} cX:{2} cY:{3}", newTopLeftX, newTopLeftY, newBottomRightX, newBottomRightY)); // Remove the overlapping ranges from the list foreach (var range in overlappingRanges) { @@ -274,7 +274,7 @@ private A.TableRow CreateTableRow(TableRow row, int rowIndex, int columnSize) { TableRow.Append(CreateTableCell(new TableCell(), row, rowIndex, columnIndex)); } - TableRow.Append(new A.ExtensionList(new A.Extension( new A16.RowIdIdentifier() { Val = (UInt32) (10000 + rowIndex) }) {Uri = "{0D108BD9-81ED-4DB2-BD59-A6C34878D82A}" })); + TableRow.Append(new A.ExtensionList(new A.Extension(new A16.RowIdIdentifier() { Val = (UInt32)(10000 + rowIndex) }) { Uri = "{0D108BD9-81ED-4DB2-BD59-A6C34878D82A}" })); return TableRow; } diff --git a/Tests/Presentation.cs b/Tests/Presentation.cs index a84ea18b..2e6e1597 100644 --- a/Tests/Presentation.cs +++ b/Tests/Presentation.cs @@ -1285,14 +1285,13 @@ private static TableRow[] CreateTableRowPayload(int rowCount = 5, int columnCoun } }; } - - tableCells.Add(new() + tableCells.Add(new TableCell { textValue = $"Row {i + 1}, Column {j + 1}", textColor = "FF0000", - fontSize = 25 / (j + 1), - rowSpan = (uint)((i == 0 && j == 0) ? 3 : 0), + fontSize = 12, + rowSpan = rowSpanVal, columnSpan = colSpanVal, borderSettings = borderColorSetting, horizontalAlignment = G.HorizontalAlignmentValues.LEFT + (i % 4)