Skip to content

Commit

Permalink
Bug Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DraviaVemal committed Jan 18, 2024
1 parent 749ce04 commit f4639e7
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<TargetFramework>net7.0</TargetFramework>
<OutputPath>..\bin\</OutputPath>
<Authors>DraviaVemal</Authors>
<Version>0.2.5-alpha.1</Version>
<Version>0.2.5-alpha.2</Version>
<Company>DraviaVemal</Company>
<Copyright>Copyright (c) 2023 DraviaVemal

Expand Down
3 changes: 1 addition & 2 deletions Global/Components/CommonProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public class CommonProperties
/// <summary>
/// Class is only for inheritance purposes.
/// </summary>
protected CommonProperties()
{ }
protected CommonProperties() { }

#endregion Protected Constructors

Expand Down
27 changes: 20 additions & 7 deletions Presentation/Internal/Components/Table.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,22 @@ private A.Table CreateTable(TableRow[] TableRows)
return Table;
}

private A.TableCell CreateTableCell(TableCell Cell)
private A.TableCell CreateTableCell(TableCell Cell, TableRow Row)
{
A.TableCell TableCell = new();
A.Paragraph Paragraph = new();
if (Cell.Alignment != null)
{
Paragraph.Append(new A.ParagraphProperties()
{
Alignment = Cell.Alignment switch
{
TableCell.AlignmentValues.CENTER => A.TextAlignmentTypeValues.Center,
TableCell.AlignmentValues.LEFT => A.TextAlignmentTypeValues.Left,
TableCell.AlignmentValues.JUSTIFY => A.TextAlignmentTypeValues.Justified,
_ => A.TextAlignmentTypeValues.Left
}
});
}
if (Cell.Value == null)
{
Paragraph.Append(new A.EndParagraphRunProperties() { Language = "en-IN" });
Expand All @@ -178,7 +190,8 @@ private A.TableCell CreateTableCell(TableCell Cell)
IsUnderline = Cell.IsUnderline,
}).GetTextBoxRun());
}
TableCell.Append(new A.TextBody(
A.TableCell TableCellXML = new();
TableCellXML.Append(new A.TextBody(
new A.BodyProperties(),
new A.ListStyle(),
Paragraph
Expand Down Expand Up @@ -214,9 +227,9 @@ private A.TableCell CreateTableCell(TableCell Cell)
new A.PresetDash() { Val = A.PresetLineDashValues.Solid }
)
{ Width = 12700, CompoundLineType = A.CompoundLineValues.Single });
TableCellProperties.Append(Cell.CellBackground != null ? CreateSolidFill(new List<string>() { Cell.CellBackground }, 0) : new A.NoFill());
TableCell.Append(TableCellProperties);
return TableCell;
TableCellProperties.Append((Cell.CellBackground != null || Row.RowBackground != null) ? CreateSolidFill(new List<string>() { Cell.CellBackground ?? Row.RowBackground! }, 0) : new A.NoFill());
TableCellXML.Append(TableCellProperties);
return TableCellXML;
}

private void CreateTableGraphicFrame(TableRow[] TableRows)
Expand Down Expand Up @@ -280,7 +293,7 @@ private A.TableRow CreateTableRow(TableRow Row)
};
foreach (TableCell cell in Row.TableCells)
{
TableRow.Append(CreateTableCell(cell));
TableRow.Append(CreateTableCell(cell, Row));
}
return TableRow;
}
Expand Down
4 changes: 2 additions & 2 deletions Presentation/Internal/Components/TextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ public TextBox(TextBoxSetting TextBoxSetting) : base(TextBoxSetting) { }
/// <returns></returns>
internal A.Run GetTextBoxRun()
{
return base.GetTextBoxBaseRun();
return GetTextBoxBaseRun();
}
/// <summary>
/// Return OpenXML Shape
/// </summary>
/// <returns></returns>
internal P.Shape GetTextBoxShape()
{
return base.GetTextBoxBaseShape();
return GetTextBoxBaseShape();
}

#endregion Internal Methods
Expand Down
30 changes: 30 additions & 0 deletions Presentation/Models/TableModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,36 @@ public class TableCell
/// </summary>
public string? Value;

/// <summary>
/// Cell Alignment Option
/// </summary>
public AlignmentValues? Alignment;

/// <summary>
/// Cell Vertical Alignment Option
/// </summary>
public enum AlignmentValues
{
/// <summary>
/// Align Left
/// </summary>
LEFT,

/// <summary>
/// Align Center
/// </summary>
CENTER,

/// <summary>
/// Align Right
/// </summary>
RIGHT,
/// <summary>
/// Align Justify
/// </summary>
JUSTIFY
}

#endregion Public Fields
}

Expand Down

0 comments on commit f4639e7

Please sign in to comment.