Adding TextBox to existing graph - TextAlignment flags seem to have no effect

I am adding text boxes to existing charts in a file I load. This works OK, but unless I missing something else I need to set, it seems that the IShapeProperties.TextFlags does not have any effect. The source indicates being able to use bit mask to centre text horizontally and vertically. Whatever I set the flags to seem leaves the text in the box top-left justified.

ShapeOptions1 := TShapeProperties_Create;
ShapeOptions1.Anchor := TClientAnchor.Create(true, TFlxAnchorType.MoveAndResize, 2693, 0, 2251, 0, 2889, 0, 2942, 0);
ShapeOptions1.ShapeType := TShapeType.Rectangle;
ShapeOptions1.ObjectType := TObjectType.Text;  // or TObjectType.MicrosoftOfficeDrawing
ShapeOptions1.ShapeName := 'TextBox 1';

ShapeOptions1.TextFlags := $223;   //$212 = Top left. This doesn't seem to work
//whatever I set seems to be Top Left

ShapeOptions1.Text := 'NIMHR346 Sample D6';
ShapeOptions1.RotateTextWithShape := true;
ShapeOptions1.ShapeThemeFont := TShapeFont_Create(TFontScheme.Minor, TDrawingColor.FromSystem(TSystemColor.WindowText));
ShapeOptions1.Print := true;
ShapeOptions1.Visible := true;
ShapeOptions1.ShapeOptions.SetValue(TShapeOption.wzName, 'TextBox 1');


Am I not doing something right, or is this not working right now?


This does now seem to be working in 7.10, though I think there is a bug in APImate that is giving me duplicate text boxes... . Of course these get removed once I pull the code in to my project :-)

Overall though 7.10 is a nice update. Thanks

Strange, I cannot see duplicated textboxes here. Is this an xls or xlsx file? Can you send me an example to so we can investigate? I am interested in knowing what could be wrong.

As far as I can see the difference depends on whether the graph is embedded on a worksheet, or is a separate sheet.

I have sent you a couple of files by email that I am playing with for my demo....

Thanks for the files. Indeed the problem was when the chart is in a separate sheet, APIMate is adding the object twice. We've fixed it, and 7.11 (coming by the end of the week) will have the fix.

@Adrian... Perhaps I should just sign myself, TMS bug hunter... ;-)

Thanks as always for your responsiveness. This one is at least rather benign for me...