Hi, i get wrong visual representation fo gradient format in saved file even tho i set the same values as in original file, am thinking that here is a problem when i read gradientDirection, you can see the picture and code below.
pic: gradient.PNG (10.7 KB)
file: FillEffect.pptx.zip (20.7 KB)
String path = "FillEffect.pptx";
Presentation presentation = new Presentation(path);
ISlide slide = presentation.getSlides().get_Item(0);
AutoShape shape = (AutoShape) slide.getShapes().get_Item(0);
IParagraph paragraph = shape.getTextFrame().getParagraphs().get_Item(0);
IPortionCollection portions = paragraph.getPortions();
IPortion portion = portions.get_Item(0);
IGradientFormatEffectiveData gradientFormat = portion.createPortionFormatEffective().getFillFormat()
.getGradientFormat();
int direction = gradientFormat.getGradientDirection();
byte gradientShape = gradientFormat.getGradientShape();
IGradientStopCollectionEffectiveData stops = gradientFormat.getGradientStops();
Portion newPortion = new Portion("Text2");
IFillFormat fillFormat = newPortion.getPortionFormat().getFillFormat();
fillFormat.setFillType(FillType.Gradient);
IGradientFormat newPortionGradient = fillFormat.getGradientFormat();
newPortionGradient.setGradientDirection(direction);
newPortionGradient.setGradientShape(gradientShape);
newPortionGradient.getGradientStops().add(stops.get_Item(0).getPosition(), stops.get_Item(0).getColor());
newPortionGradient.getGradientStops().add(stops.get_Item(1).getPosition(), stops.get_Item(1).getColor());
portions.clear();
portions.add(newPortion);
presentation.save("saved.pptx", SaveFormat.Pptx);
can you please check this out?
Thanks,
Zeljko.