PPTX setting color for table rows not overriding the template table color

Hi Team,

We are using a template PPTX which has a table with rows as white color. I am using this table for generating the table based on certain details from database.
Now, i want to update the color of any of the row in the table based on the one of the cell text of the table matching some other text say “DUMMY”.

I am using aspose slides 16.4.0

Can you please suggest a work around for the same.
I have tried setSolidFillColor, setFillType as solid, but nothing seems to work out.

Please help.

Thanks,
Sarvesh

Hi Sarvesh,


I have observed your requirements and suggest you to please try to use Aspose.Slides for Java 16.7.0 on your end. If the issue persist then please share the operating system and Java details with us. Please also share used sample code and source presentation for verification on our end.

Best Regards,

Hi Adnan,

Thanks for replying.

Actually we are facing this issue for image as well, like we want to replace the existing image with the new one. This happens at our local environment but does not work in higher environment which has the same code.

We do have the license for aspose total 16.4.0. How do we get aspose 16.7.0. Do we need to repurchase or how do we upgrade.

Hopefully, this should resolve both of our issues.

Thanks,
Sarvesh

Hi Sarvesh,

I have observed your comments. I am sharing a piece of code in a text file with you which will help you to achieve your requirements. For your image replacing requirement i request to you please follow guidelines on this link.

Best Regards,

Hi Adnan,

Thanks for the code, i shall look into it.

For image, i am able to get it done on Windows with similar code, but it’s failing in UNIX boxes.

Can you please suggest something for the same.

Thanks,
Sarvesh

Hi Sarvesh,


I have observed your comments and like to mention that the shared link is a Java code. If the code is working in Windows environment, it should be working in UNIX as well. There may be some other issue incurring on your end; possibly the path of files. I may not share any thing in this regard as the shared code snippet is a working sample.

Best Regards,

Hi Adnan,

Thanks with the help on the colouring, it was sorted out.

For image, I am using this:
BufferedImage image = getLogo( );// gets me the image
if( image != null ){
ISlide slide = pres.getSlides().get_Item(0);
IPPImage imgx = pres.getImages().addImage(image);
IShape shape = slide.findShapeByAltText(“DUMMY”);
shape.getFillFormat().setFillType(FillType.Picture);
try {
if(shape instanceof PictureFrame){
PictureFrame picFrame=(PictureFrame)shape;
picFrame.getPictureFormat().getPicture().setImage(imgx);
}
}catch(Exception e){
e.printStackTrace();
}
}

Waiting for your reply.

Thanks,
Sarvesh

Hi Sarvesh,

I have observed your code sample and there is nothing wrong in that. I have used that sample code as it is with small modification on my end to use the code and it worked perfectly. The possible issue that may be occurring on your end is likely in getLogo() method. I have used the following modified code on my end and it worked without any issue.

public static void TestImage()
{
Presentation pres=new Presentation(“C:\Aspose Data\image.pptx”);

BufferedImage image = pres.getSlides().get_Item(0).getThumbnail(1f, 1f);
// BufferedImage image = getLogo( );// gets me the image
if( image != null ){
ISlide slide = pres.getSlides().get_Item(0);
IPPImage imgx = pres.getImages().addImage(image);
IShape shape = slide.findShapeByAltText(“DUMMY”);
shape.getFillFormat().setFillType(FillType.Picture);
try {
if(shape instanceof PictureFrame){
PictureFrame picFrame=(PictureFrame)shape;
picFrame.getPictureFormat().getPicture().setImage(imgx);
}
}catch(Exception e){
e.printStackTrace();
}
}
pres.save(“C:\Aspose Data\genimage.pptx”, SaveFormat.Pptx);
}


Many Thanks,

Hi Adnan,

We get this image from a third party site, and since we are able to form the BufferedImage object, finally setting it to the IPPImage object, it should not be an issue with the getLogo method.

the only difference I see here, is you are capturing the image from the disc, whereas we do not have the image saved anywhere.

Do you think, it could be an issue.

Thanks,
Sarvesh

Hi Sarvesh,

I like to share that we are not loading image from disc. We are creating the slide thumbnail on runtime and loading that in BufferedImage object. The issue lies on your end in getLogo(). What you can do is to save the image from getLogo() method on a disc and see if that is properly extracted or not. The code sample that I have shared is doing exactly the same that it is having image in memory and not loading from any disc. I hope this will be helpful.

Many Thanks,

Hi Adnan,

I tried this as well,

BufferedImage image = getLogo //getting the image;
shape.getFillFormat().setFillType(FillType.Picture);
File outputfile = new File(“image.jpg”);
try {
ImageIO.write(image, “jpg”, outputfile);
imgx = pres.getImages().addImage(new FileInputStream(new File(“image.jpg”)));
if(shape instanceof PictureFrame){
PictureFrame picFrame=(PictureFrame)shape;
picFrame.getPictureFormat().getPicture().setImage(imgx);
}
} catch(Exception e){
e.printStackTrace();
}

it worked on windows, but it dint on unix box;

Can u pls suggest some work around.

Thanks,
Sarvesh

Hi Sarvesh,


I have observed your comments and like to mention that the shared code is in Java. If the code is working in Windows environment, it should be working in UNIX as well. There may be some other issue incurring on your end. Please make sure everything is fine on your end.

Best Regards,