TextFrameEx: setMarginLeft- setMarginRight- setMarginTop- setMarginBottom- setTextVerticalType is not working

Hello Team,


For TextFrameEx, setMarginLeft, setMarginRight, setMarginTop, setMarginBottom, setTextVerticalType is not working.

See below code:

package pptmanager;

import java.io.FileNotFoundException;

import com.aspose.slides.AsposeLicenseException;
import com.aspose.slides.CellEx;
import com.aspose.slides.License;
import com.aspose.slides.ParagraphEx;
import com.aspose.slides.PresentationEx;
import com.aspose.slides.ShapeExCollection;
import com.aspose.slides.SlideEx;
import com.aspose.slides.TableEx;
import com.aspose.slides.TextFrameEx;

public class Test6 {
public static void main(String[] args) throws FileNotFoundException, AsposeLicenseException {
License license = new License();
license.setLicense(“Aspose.Slides.lic”);
PresentationEx pres = new PresentationEx();
String presFileStr = “data/my2.pptx”;
int sldIndx = 0;
double[] dblCols = { 150, 500};
double[] dblRows = { 175, 175};
SlideEx slide2 = pres.getSlides().get_Item(sldIndx);
ShapeExCollection shapeCol = slide2.getShapes();
int index = shapeCol.addTable(33, 125, dblCols, dblRows);
TableEx tbl2 = (TableEx) shapeCol.get_Item(index);
CellEx cell2 = tbl2.get_Item(0, 0);
ParagraphEx paragraphEx2 = new ParagraphEx();
paragraphEx2.setText(“Affiliations/\nAppointments”);
TextFrameEx tf = cell2.getTextFrame();
// Below five things are not working
tf.setMarginLeft(0.01d);
tf.setMarginRight(0.01d);
tf.setMarginTop(0);
tf.setMarginBottom(0);
// I didn’t find method setRotateTextBy90Degrees in ParagraphEx.
tf.setTextVerticalType((byte)0);

tf.getParagraphs().add(paragraphEx2);
pres.write(presFileStr);
}
}

Right Click on Cell 0,0 -> Format Shape. Then click on TextBox. See margin as well as text direction is not changing as per expectations.

Hi Dipen,

Thanks for your interest in Aspose.Slides.

I have observed the properties shared by you and like to share that you need to set the margin and anchoring properties on cell level instead of TextFrame level. Please try using the following sample code on your end to serve the purpose.

cell2.setMarginLeft(0.01d);
cell2.setMarginRight(0.01d);
cell2.setMarginTop(0);
cell2.setMarginBottom(0);
// I didn’t find method setRotateTextBy90Degrees in ParagraphEx.
cell2.setTextVerticalType((byte)0);


Many Thanks,

Thanks for the reply. Its working perfactly.