We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bar in a table cell is misaligned

Hi Team,

I have a table in which I am trying to add a bar showing the responses. The offset is calculated as follows in the below method. But the bars look misaligned. Is this an issue with aspose? Could you please help resolving?

Code as follows, Please check the line where rectabgle is created. Bar offset is set with the table.Y and table cell offset.
private static IList formatBarData(CellFormaterMessage message)
var tableCell = message.TableCell;
var dataCell = message.DataCell;
var dataRow = message.DataRow;
var width = (float)tableCell.Width - (2 * horizontalPadding);
Func<double, float> calculateWidth = val => (width / 180) * (float)val;
Func<double, float> calculateNewWidth = val => (width / 100) * (float)val;
float barWidth = 0;
Paragraph p = new Paragraph();
p.Text = dataCell.Title;
p.ParagraphFormat.Alignment = TextAlignment.Left;
p.ParagraphFormat.DefaultPortionFormat.LatinFont = new FontData(message.DesignSettings.GetValueOrDefault("@UISetting-OnScreenReport-Tables-Row-Font-Type").Split(’,’)[0]);
tableCell.TextAnchorType = TextAnchorType.Top;
// tableCell.TextAnchorType = TextAnchorType.Center;
bool is100Perc = false;
if (message.DataCell.BarLength.HasValue)
barWidth = message.DataCell.BarLength.Value;
barWidth = float.Parse(message.DataCell.Title.Substring(0, message.DataCell.Title.Length - 1));
float newBarWidth = calculateNewWidth(barWidth);
if (barWidth ==100)
is100Perc = true;
// p.Text = “\n " + p.Text;
var r = AddShapeUtils.AddRectangle((ISlide)message.TableCell.Slide, message.DesignSettings.GetValueOrDefault(”@UISetting-OnScreenReport-Charts-Series1-Color").GetColor(), message.DesignSettings, (float)tableCell.OffsetX + message.Table.X + horizontalPadding,
(float)tableCell.OffsetY + message.Table.Y + verticalPadding, is100Perc ? calculateWidth(barWidth) : newBarWidth, height);
r.Name = “Bar” + shapeID.ToString();
if (dataRow.ItemType == QVDatasourceTransformer.Page.DataView.ItemTypeEnum.Category)
SetCategoryRowFontAndBackground(p, message, tableCell);

portion =>
portion.PortionFormat.FontBold = NullableBool.True;
SetRowFontAndBackground(p, message, tableCell);

paragraph =>
paragraph.ParagraphFormat.MarginLeft = is100Perc ? calculateWidth(barWidth) : newBarWidth;

return new List {r};

Hi team,

One more observation is, this happens only when the font type is SEGOE UI. Does not happen for other font types.

Hi Priya,

I have observed the sample code shared by you and by looking into it the approach looks fine. Also, as per your new comments that it only happens with a particular font type. I suggest you to please first try using the latest version Aspose.Slides for .NET 16.2.0 on your end. If there is still an issue then please provide the working sample project, problematic font and source presentation reproducing the issue. I will be able to investigate the issue further on provision of requested information.

Many Thanks,