Spire.Presentation 8.11.1 supports obtaining the height and width of the text area within a shape

2023-11-30 03:30:33

We are excited to announce the release of Spire.Presentation 8.11.1. This version releases several new features, such as obtaining the height and width of the text area within a shape and retrieving text from different lines within a shape. Besides, it also fixes the issue that the program threw System.InvalidCastException exception when executing the shape.TextFrame.GetTextLocation() method. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREPPT-2378 Supports preserving position information of shapes relative to slides when converting shapes to SVG.
byte[] svgByte = shape.SaveAsSvgInSlide();
FileStream fs = new FileStream("shapePath_" + num + ".svg", FileMode.Create);
fs.Write(svgByte, 0, svgByte.Length);
fs.Close();
New feature SPIREPPT-2379 Supports obtaining the height and width of a text area within a shape.
IAutoShape autoShape = shape as IAutoShape;
SizeF size = autoShape.TextFrame.GetTextSize();
New feature SPIREPPT-2384 Supports retrieving text from different lines within a shape.
Presentation ppt = new Presentation();
ppt.LoadFromFile(inputFile);
ISlide slide = ppt.Slides[0];
for (int i = 0; i < slide.Shapes.Count; i++)
{
    IAutoShape shape = (IAutoShape)slide.Shapes[i];
    File.AppendAllText(outputFile, "shape" + i + ":" + "\r\n");
    IList<LineText> lines = shape.TextFrame.GetLayoutLines();
    for (int j = 0; j < lines.Count; j++)
    {
        File.AppendAllText(outputFile,"line[" + j + "]:" + lines[j].Text + "\r\n");
    }
}
New feature SPIREPPT-2390 Supports retrieving the ShapeID property of an OleObject object.
Presentation ppt = new Presentation();
ppt.LoadFromFile(inputFile);
OleObjectCollection oles = ppt.Slides[0].OleObjects;
OleObject oleObject = oles[0];
StringBuilder sb = new StringBuilder();
sb.AppendLine("ShapeID=" + oleObject.ShapeID);
foreach (DictionaryEntry entry in oleObject.Properties)
{
    sb.AppendLine(entry.Key + ":" + entry.Value);
}
File.AppendAllText(outputFile, sb.ToString());
Bug SPIREPPT-2391 Fixes the issue that the program threw System.InvalidCastException when executing shape.TextFrame.GetTextLocation() method.
Click the link below to download Spire.Presentation 8.11.1:
More information of Spire.Presentation new release or hotfix: