Aspose.SlideEx methods

Hello,

I’m from XCoders company, and we decide to implement PowerPoint 2007. I know, we need slideEx,
but some api was changed there, so I need help in several methods (all in slideEx):

  1. How to addTable? List of parameters was changed and in manual there isn’t example.(in slides we set also border and color, how to set it in SlidesEx)
  2. Presentation.getFonts() - how to do it in slidesEx?
  3. How to add Rectangle?
  4. In slide was method slide.getHeaderFooter(). Where it in slideEx?
  5. how to addPictureFrame?

May be I’ll find another questions later.
For a better understanding of problem there is a part of code in ppt, how to implement it on PPTX

public void export( TableComponent table )
{
int slideWidth = slide.getBackground().getWidth() - AsposeUtility.DEFAULT_LEFT_MARGIN * 5;
int slideHeight = slide.getBackground().getHeight();

int columnCount = 1;
int rowCount = 7;
float border = 0;
int x = AsposeUtility.DEFAULT_LEFT_MARGIN * 2;
int y = 1700; //slideHeight - slideHeight / 3;
int width = slideWidth;
int height = 0;

try
{

Table aTable = slide.getShapes().addTable( x, y, width, height, columnCount, rowCount, border,
java.awt.Color.WHITE );
Row row;
for( int i = 0; i < table.getRowCount(); i++ )
{
row = table.getRow( i );
final Cell cell = row.getCell( 0 );
if(i>=rowCount-1)
{
addCell( new CellImpl() {
@Override
public Object getValue()
{
return "...";
}

@Override
public Style getStyle()
{
return cell.getStyle();
}
}, aTable, rowCount - 1 );
break;
}
addCell( cell, aTable, i );
}

aTable.setColumnWidth( 0, slideWidth );
for( int i = 0; i < aTable.getRowsNumber(); i++ )
{
aTable.setRowHeight( i, 10 );
}
}
catch( AsposeLicenseException exception )
{
log.error( exception.getMessage(), exception );
return;
}

}

private void addCell( Cell cell, Table aTable, int rowIndex )
{
Style style = cell.getStyle();
com.aspose.slides.Cell aCell = aTable.getCell( 0, rowIndex );

Paragraph paragraph = aCell.getTextFrame().getParagraphs().get( 0 );
paragraph.setText( cell.getValue().toString() );
paragraph.setAlignment( com.aspose.slides.TextAlignment.RIGHT );

Portion port = paragraph.getPortions().get( 0 );
port.setFontBold( false );

if(style != null){
port.setFontColor( style.getFontColor() );
port.setFontHeight( style.getFontHeight() );
port.setFontIndex( AsposeUtility.getFontIndex( presentation, style.getFontName() ) );
}else{
style = new Style();
style.setFontName( AsposeUtility.FONT_NAME_SEGOE );
port.setFontColor( Color.BLACK );
port.setFontHeight( (short)10 );
port.setFontIndex( AsposeUtility.getFontIndex( presentation, style.getFontName() ) );
}

}

Hi Vasily,


You can do almost every thing required by you in case of PPTX for SlideEx. Please visit the following links for your further kind reference and if the issue is still there then please share with us.

  1. Creating Table in PPTX
  2. Adding Rectangle Shape
  3. Adding Picture Frame
  4. Managing Fonts
  5. Working with Text

Moreover, there are no real header footers in PPTX, so they are not supproted. One can add the autoshape in place of header footers. Please visit this link for your further reference.


Many Thanks,

Thanks for links.

When I add picture via addPictureFrame, can I set line border to none?
I tried to do next,

int shapeId = slide.getShapes().addPictureFrame(ShapeTypeEx.RECTANGLE, x, y, width, height, picture);
PictureFrameEx pf = (PictureFrameEx) slide.getShapes().get( shapeId );
pf.getLineFormat().setStyle( LineStyleEx.NOT_DEFINED );

but border didn’t disappears. How set border to “none”?

Hi Vasily,


The following code snippet must be used to remove the border from picture frame. Unfortunately, there is some short coming in Aspose.Slides for Java and the code is not working. An issue with ID 32648 has been created to further investigate and resolve the issue as the similar code is working perfectly fine for Aspose.Slides for .NET as shown here.

//Instantiate PrseetationEx class that represents the PPTX
PresentationEx pres = new PresentationEx();
//Get the first slide
SlideEx sld = pres.getSlides().get(0);
//Instantiate the ImageEx class
BufferedImage img= ImageIO.read(new File(“C:/Users/Public/Pictures/Sample Pictures/Desert.jpg”));
ImageEx imgx = pres.getImages().addImage(img);
//Add Picture Frame with height and width equivalent of Picture
sld.getShapes().addPictureFrame(ShapeTypeEx.RECTANGLE, 50, 150, imgx.getWidth(), imgx.getHeight(),imgx);
ShapeEx sh=sld.getShapes().get(0);
sh.getLineFormat().getFillFormat().setFillType (FillTypeEx.NOFILL );
//Write the PPTX file to disk
pres.write(“d:\Aspose Data\RectPicFrameJ.pptx”);


We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESJAVA-32648) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.