I am really not happy with the Output by Aspose.Slide.
Hi Pankaj,
I have attached a file Thrivent_Scorecard.pptx.
Hi Pankaj,
Hi,
I am also facing the issue while exporting the chart image on slide. Can you please update me on this, My sample code is below:
Presentation pres = new Presentation(@"C:\WorkArea\WebApplication1\UI\Template\SampleTemplateForChart.ppt");
Slide sld = null;
Aspose.Slides.Shapes shp = null;
//code for creating multiple slides for multiple charts 31Dec2012
string chartDirectory = "C:/WorkArea/WebApplication1/UI/images/Chart/";
//string[] files = Directory.GetFiles(chartDirectory, "*.jpeg", SearchOption.TopDirectoryOnly);
string[] files = Directory.GetFiles(chartDirectory, "*.jpg", SearchOption.TopDirectoryOnly);
//string[] files = new string[1];
//files[0] = "chart1.jpg";
int loopCount = 0;
foreach (string imagePath in files)
{
if (imagePath.Substring(imagePath.IndexOf("chart")).Contains("13"))
{
if (loopCount == 0)
{
sld = pres.GetSlideByPosition(1);
}
else
{
sld = pres.GetSlideByPosition(pres.Slides.LastSlidePosition - 1);
pres.CloneSlide(sld, pres.Slides.LastSlidePosition);
sld.SlidePosition = pres.Slides.LastSlidePosition - 1;
}
shp = sld.Shapes;
Shape shape;
int picId;
Picture pic;
for (int i = 0; i < shp.Count; i++)
{
Aspose.Slides.Shape shap = shp[i];
string str = "";
str = shap.AlternativeText;
if (str == "Image1")
{
Aspose.Slides.Shape tx = (Aspose.Slides.Shape)shap;
// Getting coordinates of the shape
int xx = tx.X;
int yy = tx.Y;
int width = tx.Width;
int height = tx.Height;
shape = sld.Shapes.AddRectangle(xx, yy, width, height);
shape.FillFormat.Type = FillType.NoFill;
shape.FillFormat.Type = FillType.Picture;
shape.AlternativeText = tx.AlternativeText;
shape.Name = tx.AlternativeText;
// Creating a picture object that will be used to fill the rectagular shape
pic = new Picture(pres, imagePath);
picId = pres.Pictures.Add(pic);
shape.FillFormat.PictureId = picId;
sld.Shapes.Remove(tx);
}
}
loopCount = loopCount + 1;
}
}
pres.Write(@"C:\AsposeChart.ppt");
I have attached the image and slide generated.
Hi Pranav,
Yes you are right. You have already shared the sample code earlier.
The issue is the image which I am exporting into aspose slide is not of the same quality as we see in the image file. Please find the attached sample template whihc I am using to export. Also find attached the the image file.
Hi Pranav,
public static void AddImageFrame(){//Instantiate a Presentation object that represents a PPT filePresentation pres = new Presentation();//Accessing a slide using its slide positionSlide slide = pres.GetSlideByPosition(1);//Creating a picture object that will be used to fill the ellipsePicture pic = new Picture(pres, @“chart13.jpg”);//Adding the picture object to pictures collection of the presentation//After the picture object is added, the picture is given a uniqe picture Idint picId = pres.Pictures.Add(pic);//Calculating picture width and heightint pictureWidth = pres.Pictures[picId - 1].Image.Width * 4;int pictureHeight = pres.Pictures[picId - 1].Image.Height * 4;//Calculating slide width and heightint slideWidth = slide.Background.Width;int slideHeight = slide.Background.Height;//Calculating the width and height of picture frameint pictureFrameWidth = Convert.ToInt32(slideWidth / 2 - pictureWidth / 2);int pictureFrameHeight = Convert.ToInt32(slideHeight / 2 - pictureHeight / 2);//Adding picture frame to the slideslide.Shapes.AddPictureFrame(picId, pictureFrameWidth, pictureFrameHeight, pictureWidth, pictureHeight);//Writing the presentation as a PPT filepres.Write(@“modified.ppt”);}
Hi,
Please find attached the actual image file and the generated ppt using your code. I still find the burred image in ppt slide.
Let me know if we can improve this.
Thanks.
Hi,
The issues you have found earlier (filed as SLIDESNET-33640) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.