Spire.Presentation 8.10.2 supports getting location information of the text within shapes

2023-10-18 01:48:09

We are pleased to announce the release of Spire.Presentation 8.10.2. This version supports getting location information of the text within shapes. Besides, it also supports getting the Ascent and Descent properties of the text within shapes and converting shapes to SVG format. What's more, it has fixed the issue that there was a blank space when opening SVG files in the browser after converting PPT to SVG. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREPPT-2324 Supported the functionality to obtain the text position information within a shape.
Presentation ppt = new Presentation();
ppt.LoadFromFile(inputFile);
StringBuilder sb = new StringBuilder();
ISlide slide = ppt.Slides[0];
for (int i = 0; i < slide.Shapes.Count; i++)
 {
     IShape shape = slide.Shapes[i];
     if (shape is IAutoShape)
     {
         IAutoShape autoshape = slide.Shapes[i] as IAutoShape;
         string text = autoshape.TextFrame.Text;
         //obtain the text position information
         PointF point = autoshape.TextFrame.GetTextLocation();
         sb.AppendLine("Shape " + i + ":" + text + "\r\n" + "location:" + point.ToString());
     }
}
File.AppendAllText(outputFile, sb.ToString());
ppt.Dispose();
New feature SPIREPPT-2350 Supported the functionality to get the Ascent and Descent properties of text within a Shape.
Presentation ppt = new Presentation();
ppt.LoadFromFile(inputFile);
ISlide slide = ppt.Slides[0];
IAutoShape autoshape = slide.Shapes[0] as IAutoShape;
IList<LineText> lines = autoshape.TextFrame.GetLayoutLines();
for (int i = 0; i < lines.Count; i++)
{
   float ascent= lines[i].Ascent;
   float descent = lines[i].Descent;
}
New feature SPIREPPT-2365 Supported the functionality to convert shapes to SVG format.
Presentation ppt = new Presentation();
ppt.LoadFromFile("FreeForm.pptx");
ISlide slide = ppt.Slides[0];
int num = 0;
foreach (IShape shape in slide.Shapes)
{
    byte[] svgByte = shape.SaveAsSvg();
    FileStream fs = new FileStream("shape_" + num + ".svg",FileMode.Create);
    fs.Write(svgByte, 0, svgByte.Length);
    fs.Close();
    num++;
}
Bug SPIREPPT-2350 Fixed the issue of SVG files appearing blank when opening them in a browser after converting PPT to SVG.
Click the link below to download Spire.Presentation 8.10.2:
More information of Spire.Presentation new release or hotfix: