Skip to content

Commit

Permalink
Merge branch 'main' into 70-color-options-update
Browse files Browse the repository at this point in the history
  • Loading branch information
DraviaVemal authored Jun 27, 2024
2 parents 22d89ed + 79ba4a2 commit bb6382b
Showing 2 changed files with 9 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Presentation/Components/2007/Table.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
@@ -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));

Check notice on line 187 in Presentation/Components/2007/Table.cs

Codacy Production / Codacy Static Code Analysis

Presentation/Components/2007/Table.cs#L187

Use the overload that takes a 'CultureInfo' or 'IFormatProvider' parameter.
// 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;
}

7 changes: 3 additions & 4 deletions Tests/Presentation.cs
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit bb6382b

Please sign in to comment.