Aspose table cell.OffsetY is working weird after upgrading to 18.2 from 14.8

Hi team,
We have created a table object and tried to fit in some bar objects (stacked - favorable, neutral and unfavorable) for a report.

It was working properly before upgrade to 18.2 but unfortunately it seems to be displaced after the upgrade.

Below is the code snippet that we have used to achieve this. Please check the addRectangle inline method.

private static IList formatThreeBar(CellFormaterMessage message)
{
var tableCell = message.TableCell;
var dataCell = message.DataCell;
var dataRow = message.DataRow;
var fontSize = message.FontSize;

        if (((dataCell.Favorable == null && dataCell.Neutral == null && dataCell.Unfavorable == null) || (Double.IsNaN(dataCell.Favorable.Value) && Double.IsNaN(dataCell.Neutral.Value) && Double.IsNaN(dataCell.Unfavorable.Value))))
        {
            if (dataCell.RawData == Setup.NanValueStr || dataCell.RawData == "")
            {
                dataCell.Title = message.NAText;
            }
            return formatScoreData(message);
        }

        tableCell.TextFrame.Text = "";
        bool isAlt = message.TableCell.FirstRowIndex % 2 == 0 && !message.IsBreakoutTable;

        if (dataRow.ItemType == QVDatasourceTransformer.Page.DataView.ItemTypeEnum.Category && !message.IsCategoriesOnlyTable)
            SetCellBackgroundColor(message.TableCell, message.DesignSettings.GetValueOrDefault("@UISetting-OnScreenReport-Tables-Category-Background-Color").GetColor());
        else
        {
            SetCellBackgroundColor(message.TableCell,
               message.DesignSettings.GetValueOrDefault("@UISetting-OnScreenReport-Tables-" + (isAlt ? "Alt" : "") + "Row-Background-Color").GetColor());
        }

        var shapes = tableCell.Slide.Shapes;
        var width = (float)tableCell.Width - (2 * horizontalPadding);
        var x = (float)(tableCell.OffsetX + tableCell.Table.X);
        var y = (float)(tableCell.OffsetY + tableCell.Table.Y - message.BarOffsetY);
        var currentRectangleIndex = 0;

        Dictionary<int, string> barItems;
        if (message.LanguageIsRightToLeft)
        {
            barItems = new Dictionary<int, string>() { { 0, "UnFav" }, { 1, "Neu" }, { 2, "Fav" } };
        }
        else
        {
            barItems = new Dictionary<int, string>() { { 0, "Fav" }, { 1, "Neu" }, { 2, "UnFav" } };
        }
        
        Func<double, float> calculateWidth = val => (width / 100) * (float)val;
        IAutoShape lastRectangle = null;
        IGroupShape group = shapes.AddGroupShape(); //WCC-2693 - To group the rectangles.
        group.Name = "ThreeBarGroup" + shapeID;
        Func<double?, IShape> addRectangle = val =>
        {
            var rectX = lastRectangle != null ? lastRectangle.X + lastRectangle.Width : x + horizontalPadding;
            var currentRect =
               group.Shapes.AddAutoShape(ShapeType.Rectangle, rectX, **_y + verticalPadding_**, calculateWidth(val.Value), height);//WCC-2693 - Rectagle is created as a part of the grouped shape
            if (lastRectangle == null)
            {
                var rec = currentRect.Y;
            }
            currentRect.Name = "ThreeBar" + shapeID.ToString();
            shapeID++;
            currentRect.FillFormat.FillType = FillType.Solid;
            
            Color backgroundColor = message.DesignSettings.GetValueOrDefault(String.Format("@UISetting-OnScreenReport-{0}-Shading-Color".ToString(), barItems[currentRectangleIndex])).GetColor();
            Color foreColor = message.DesignSettings.GetValueOrDefault(String.Format("@UISetting-OnScreenReport-{0}-Font-Color", barItems[currentRectangleIndex]).ToString()).GetColor();

            currentRect.FillFormat.SolidFillColor.Color = backgroundColor;
            currentRect.LineFormat.FillFormat.FillType = FillType.NoFill;
            currentRect.LineFormat.Width = 0;
            if(currentRect.Width>18)
            {
                var valueTextFrame = currentRect.AddTextFrame(string.Format("{0:F0}%", val.Value));
                valueTextFrame.TextFrameFormat.CenterText = NullableBool.True;
                valueTextFrame.OnEachPortion(portion =>
                {
                    var portionFormat = portion.PortionFormat;
                    portionFormat.FillFormat.FillType = FillType.Solid;
                    portionFormat.FillFormat.SolidFillColor.Color = foreColor;
                    portionFormat.FontHeight = fontSize;

                });
                valueTextFrame.OnEachParagraph(para =>
                    {
                        para.ParagraphFormat.DefaultPortionFormat.LatinFont =
                            new FontData(
                            message.DesignSettings.GetValueOrDefault("@UISetting-OnScreenReport-Tables-Row-Font-Type").Split(',')[0]);
                    });
                valueTextFrame.TextFrameFormat.WrapText = NullableBool.False;
                
            }
            lastRectangle = currentRect;
            currentRectangleIndex++;
            return currentRect;
        };
        if ((dataCell.Favorable == null && dataCell.Neutral == null && dataCell.Unfavorable == null) || (dataCell.Favorable.Value == Setup.NaNValue && dataCell.Neutral.Value == Setup.NaNValue && dataCell.Unfavorable.Value == Setup.NaNValue))
        {
            if (dataCell.Attributes.Count > 0 &&
                dataCell.Attributes.Exists(a => a.Name == "ScorelessItem") &&
                Boolean.Parse(dataCell.Attributes.First(b => b.Name == "ScorelessItem").Value))
            {
                return null;
            }
            else
            {
                tableCell.TextFrame.Text = message.NAText;
                return null;
            }
        }
        else if ((dataCell.Favorable.Value == 0.0 && dataCell.Unfavorable.Value == 0.0 && dataCell.Neutral.Value == 0.0) || (dataCell.Favorable.Value == Setup.ZeroValue && dataCell.Unfavorable.Value == Setup.ZeroValue && dataCell.Neutral.Value == Setup.ZeroValue))
        {
            tableCell.TextFrame.Text = "0%";
            return null;
        }

        List<IShape> rectangle;
        if (message.LanguageIsRightToLeft)
        {
            rectangle = new List<IShape>()
            {
                group,
                addRectangle(dataCell.Unfavorable),
                addRectangle(dataCell.Neutral),
                addRectangle(dataCell.Favorable)
            };
        }
        else
        {
            rectangle = new List<IShape>()
            {
                group,
                addRectangle(dataCell.Favorable),
                addRectangle(dataCell.Neutral),
                addRectangle(dataCell.Unfavorable)
            };
        }           
        
        return rectangle; 
    }

OverlappingSlide.zip (54.9 KB)

@Priyarav87,

I have observed your comments. Can you please try to use Aspose.Slides latest version 18.4 on your end and share feedback with us if there is still an issue. Also please share sample project along with environment details so that we can further investigate to help you out.

Updating to 18.4 did not solve.

@Priyarav87,

I have observed your comments. Can you please share working sample project so that we can further reproduce issue to help you out.

I have somehow tried to fix this by adjusting the Yposition of the bars inside the table cell. However, the same file is saved as a PDF behaves weird and produces wrong results. Please see the attachment.

PDF after Fix.pdf (38.8 KB)
Refer Pg6 PDF Before Fix.pdf (189.4 KB)

Please refer page No. 6 in the “Before Fix” pdf and page no: 1 in “After fix” pdf attached.

@Priyarav87,

I have observed the two PDF files shared by you. As requested earlier, please provide working sample project along with source presentation deck used on your end that we may test on our end to reproduce the issue. Please also share the Aspose.Slides for .NET version with which things have been working fine on your end before. Please share the requested information so that we may proceed further to help you.

It was working fine with 17.8. Recently we upgraded to 18.2. I cannot share a sample project as it involves lot of manipulations to be done. Since we are placing an object inside another. The code snippet that I have shared you is exactly the place where we are getting a reference to the table cells and marking the YPosition for the bars to fit into the table cells.

I think it is not too complex to understand. Incase you still need to understand please let me know.

@Priyarav87,

I request you to please share a scaled down sample project reproducing the issue on your end so that we may verify and log the issue for resolution. Unfortunately, without provision of requested information, it is not possible to investigate the issue further on our end.