ISvgShapeAndTextFormattingController Interface

Controls SVG shape and text generation.

Namespace:  Aspose.Slides.Export
Assembly:  Aspose.Slides (in Aspose.Slides.dll) Version: 21.2.0.0 (21.2)
Syntax
public interface ISvgShapeAndTextFormattingController : ISvgShapeFormattingController

The ISvgShapeAndTextFormattingController type exposes the following members.

Properties
  NameDescription
Public propertyAsISvgShapeFormattingController
Returns ISvgShapeFormattingController interface.
Methods
  NameDescription
Public methodFormatShape
This function is called before rendering of shape to SVG to allow user to control resulting SVG.
(Inherited from ISvgShapeFormattingController.)
Public methodFormatText
This function is called before rendering of text portion to SVG to allow user to control resulting SVG.
Examples
Example:
[C#]
class CustomSvgShapeFormattingController : ISvgShapeAndTextFormattingController
{
    private int m_shapeIndex, m_portionIndex, m_tspanIndex;
    public CustomSvgShapeFormattingController(int shapeStartIndex = 0)
    {
        m_shapeIndex = shapeStartIndex;
        m_portionIndex = 0;
    }
    public void FormatShape(Aspose.Slides.Export.ISvgShape svgShape, IShape shape)
    {
        svgShape.Id = string.Format("shape-{0}", m_shapeIndex++);
        m_portionIndex = m_tspanIndex = 0;
    }
    public void FormatText(Aspose.Slides.Export.ISvgTSpan svgTSpan, IPortion portion, ITextFrame textFrame)
    {
        int paragraphIndex = 0; int portionIndex = 0;
        for (int i = 0; i < textFrame.Paragraphs.Count; i++)
        {
            portionIndex = textFrame.Paragraphs[i].Portions.IndexOf(portion);
            if (portionIndex > -1) { paragraphIndex = i; break; }
        }
        if (m_portionIndex != portionIndex)
        {
            m_tspanIndex = 0;
            m_portionIndex = portionIndex;
        }
        svgTSpan.Id = string.Format("paragraph-{0}_portion-{1}_{2}", paragraphIndex, m_portionIndex, m_tspanIndex++);
    }
}
See Also