I have observed your requirement and regret to share that what you are doing is not possible. The group shape is only a cluster or group of shapes. GroupShape it self is not a normal shape. You need to access a particular shape inside group shape collection and then add SVG to that. This is neither an issue nor a limitation of API.
Okey i see there is no way to add text from a svg image to the slide with aspose.slides.
In Powerpoint ( Version 16.37 ) there is a way to convert an imported svg image to a group shape - with text ! ( Right click on the svg and click “convert to shapes…” ): pptx.png (100.6 KB)
My example svg with multiple forms and texts in it: test.svg.zip (21.2 KB)
Is there a similar function in Aspose.Slides to convert an imported svg to group shapes with texts ?
In the example link that I have shared, its evident that SVG content is added as string. If you have file as SVG, you can read the file and convert to string. If you have a SVG string, you can directly add that in presentation Image collection.
There is no such option to import an SVG in group shape. As mentioned earlier, group shape is only a logical collection of shapes grouped together. This is neither a limitation nor an issue.
@mudassir.fayyaz
In the example link that I have shared, its evident that SVG content is added as string. If you have file as SVG, you can read the file and convert to string. If you have a SVG string, you can directly add that in presentation Image collection.
When i use that way to add svg to the slide and then convert that image to a group Shape like in your documentation:
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_PresentationSaving();
using (Presentation pres = new Presentation(dataDir+ "image.pptx"))
{
PictureFrame pFrame = pres.Slides[0].Shapes[0] as PictureFrame;
ISvgImage svgImage = pFrame.PictureFormat.Picture.Image.SvgImage;
if (svgImage != null)
{
// Convert svg image into group of shapes
IGroupShape groupShape = pres.Slides[0].Shapes.AddGroupShape(svgImage, pFrame.Frame.X, pFrame.Frame.Y,
pFrame.Frame.Width, pFrame.Frame.Height);
// remove source svg image from presentation
pres.Slides[0].Shapes.Remove(pFrame);
}
pres.Save(dataDir + "image_group.pptx", SaveFormat.Pptx);
}
All texts are gone and missing that exists in the svg image… that’s my problem !
Powerpoint not remove texts by convert it to shapes like my example from above.
Can you please provide the source presentation file used in your sample code that I may use on my end to test your code and add ticket in our issue tracking system.
Than you for sharing the information. An issue with ID SLIDESNET-41966 has been created in our issue tracking system to further investigate the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.