Hello.
I need help with grouping shapes in aspose slides.
I have a .pptx template with existing textbox with a set alttext name. I’m also trying to generate shapes from a svg file. The textbox should hold the name of the svg file.
After successful generating shapes from the svg file I’d like to group both the svg file (grouped using IGroupShape AddGroupShape(ISvgImage svgImage, float x, float y, float width, float height)
How do I group svgImage with the textbox?
PS: The template already have the textbox and the shapes from svgImage are created by specifying the svg file name.
Here’s the source code.
using (Aspose.Slides.Presentation pres = new Aspose.Slides.Presentation(Application.StartupPath + @"\Templates\Template1.pptx"))
{
try
{
string svgContent1 = File.ReadAllText(dataGridView1.Rows[0].Cells[1].Value.ToString());
ISvgImage svgImage1 = new SvgImage(svgContent1);
pres.Slides[0].Shapes.AddGroupShape(svgImage1, (float)66.79292, (float)110.5453, (float)52.56, (float)52.56);
IShape Text0_1 = SearchTextBox.FindShape(pres.Slides[0], "TextBox1");
if (Text0_1 != null)
{
((IAutoShape)Text0_1).TextFrame.Text = dataGridView1.Rows[0].Cells[1].Value.ToString();
}
SaveFileDialog sfd = new SaveFileDialog();
sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
sfd.Title = "Save PowerPoint Icons";
sfd.CheckFileExists = false;
sfd.CheckPathExists = true;
sfd.DefaultExt = "pptx";
sfd.Filter = "Powerpoint Files (*.pptx) | *.pptx";
sfd.FilterIndex = 1;
sfd.RestoreDirectory = true;
if (sfd.ShowDialog() == DialogResult.OK)
{
pres.Save(sfd.FileName, SaveFormat.Pptx);
Cursor = Cursors.Default;
}
}
catch (FileFormatException ex)
{
MessageBox.Show(ex.Message.ToString());
}
}