The tests below demonstrates the issues. I believe these are bugs.
[Fact]
public void EndTable_should_not_set_Bold_to_true()
{
var builder = new DocumentBuilder();
builder.StartTable();
builder.Font.Bold = true;
builder.InsertCell();
builder.EndRow();
builder.Font.Bold = false;
Assert.False(builder.Font.Bold); // pass
builder.EndTable();
Assert.False(builder.Font.Bold); // fail
}
[Fact]
public void EndTable_should_not_set_Color_to_Blue()
{
var builder = new DocumentBuilder();
builder.StartTable();
builder.Font.Color = Color.Blue;
builder.InsertCell();
builder.EndRow();
builder.Font.Color = Color.Empty;
AssertEqual(Color.Empty, builder.Font.Color); // pass
builder.EndTable();
AssertEqual(Color.Empty, builder.Font.Color); // fail
}
// https://docs.microsoft.com/en-us/dotnet/api/system.drawing.color.equals
private static void AssertEqual(Color expected, Color actual) =>
Assert.Equal(expected, actual, new ColorEqualityComparer());
private class ColorEqualityComparer : IEqualityComparer<Color>
{
public bool Equals(Color x, Color y) =>
x.ToArgb() == y.ToArgb();
public int GetHashCode(Color obj) =>
throw new NotImplementedException();
}
Aspose.Words 17.7.0
.NET Framework 4.5.2