I create a TextFrame with example code but I try million ways and still can not get Border of text frame go away.
version: Aspose Slides 14.4.0
IShape sh= slide.getShapes().addAutoShape(ShapeType.Rectangle, 5, 0, 710, 50);
sh.getFillFormat().setFillType(FillType.NoFill);
ILineFormat lineFormat = sh.getLineFormat();
lineFormat.getFillFormat().getSolidFillColor().setColor(Color.white);
lineFormat.setStyle(LineStyle.NotDefined);
=========================
Hi Benjamin,
I have worked over the requirements shared by you and have created the sample code to serve the purpose on your end. Please share, if I may help you further in this regard.
public static void adddText()
{
//Instantiate Presentation class that represents PPTX
Presentation pres = new Presentation();
//Access first slide
ISlide sld = pres.getSlides().get_Item(0);
//Add an AutoShape of Rectangle type
IAutoShape ashp = sld.getShapes().addAutoShape(ShapeType.Rectangle, 150, 75, 150, 50);
// ashp.getFillFormat().setFillType(FillType.NoFill);
ILineFormat lineFormat = ashp.getLineFormat();
lineFormat.getFillFormat().setFillType(FillType.NoFill);
lineFormat.getFillFormat().getSolidFillColor().setColor(java.awt.Color.WHITE);
//Add TextFrame to the Rectangle
ashp.addTextFrame(" ");
//Accessing the text frame
ITextFrame txtFrame = ashp.getTextFrame();
//Create the Paragraph object for text frame
IParagraph para = txtFrame.getParagraphs().get_Item(0);
//Create Portion object for paragraph
IPortion portion = para.getPortions().get_Item(0);
//Set Text
portion.setText(“Aspose TextBox”);
//Save the PPTX to Disk
pres.save(“D:\Aspose Data\NotesSlide.pptx”, SaveFormat.Pptx);
}
Many Thanks,
I run the given code as
Presentation pres = new Presentation();
//Access first slide
ISlide sld = pres.getSlides().get_Item(0);
//Add an AutoShape of Rectangle type
IAutoShape ashp = sld.getShapes().addAutoShape(ShapeType.Rectangle, 150, 75, 150, 50);
// ashp.getFillFormat().setFillType(FillType.NoFill);
ILineFormat lineFormat = ashp.getLineFormat();
lineFormat.getFillFormat().setFillType(FillType.NoFill);
lineFormat.getFillFormat().getSolidFillColor().setColor(java.awt.Color.WHITE);
//Add TextFrame to the Rectangle
ashp.addTextFrame(" ");
//Accessing the text frame
ITextFrame txtFrame = ashp.getTextFrame();
//Create the Paragraph object for text frame
IParagraph para = txtFrame.getParagraphs().get_Item(0);
//Create Portion object for paragraph
IPortion portion = para.getPortions().get_Item(0);
//Set Text
portion.setText(“Aspose TextBox”);
//Save the PPTX to Disk
// pres.save(file., SaveFormat.Pptx);
try {
FileOutputStream fop = new FileOutputStream(file);
pres.save(fop, SaveFormat.Ppt);
} catch (FileNotFoundException e) {
}
--------------------------------------------
It does not give the right result.
Please note that I run the code with Aspose slides. 14.4.0
I have attached my result
Our developer team found out the solution
ILineFormat lineFormat = sh.getLineFormat();
sh.getLineFormat().getFillFormat().setFillType(FillType.NoFill);
would make the frame disappear.
Hi Benjamin,
That is appreciable that things have worked on your end. In fact I have shared the same code in my previous post for setting the no fill for shape border line. Please share, if I may help you further in this regard.
Many Thanks,
Thank you for your answer.