Set Margins of Comment or Shape inside the Worksheet

Possible Usage Scenarios

Aspose.Cells allows you to set the margins of any shape or comment using the Shape.TextBody.TextAlignment property. This property returns the object of Aspose.Cells.Drawing.Texts.ShapeTextAlignment class which has different properties e.g. TopMarginPtLeftMarginPt, BottomMarginPt, RightMarginPt, etc. that can be used to set the top, left, bottom and right margins.

Set Margins of Comment or Shape inside the Worksheet

Please see the following sample code. It loads the sample Excel file that contains two shapes. The code accesses the shapes one by one and sets their top, left, bottom and right margins. Please see the output Excel file generated by the code and screenshot showing the effect of the code on the output Excel file.

todo:image_alt_text

Sample Code