com.aspose.slides

Interfaces

Classes

Exceptions

com.aspose.slides

Interface ISvgShapeAndTextFormattingController

  • All Superinterfaces:
    ISvgShapeFormattingController


    public interface ISvgShapeAndTextFormattingController
    extends ISvgShapeFormattingController

    Controls SVG shape and text generation.


    Example:
     
     class CustomSvgShapeFormattingController implements ISvgShapeAndTextFormattingController
     {
         private int m_shapeIndex, m_portionIndex, m_tspanIndex;
    
         public CustomSvgShapeFormattingController(int shapeStartIndex)
         {
             m_shapeIndex = shapeStartIndex;
             m_portionIndex = 0;
         }
         public void formatShape(ISvgShape svgShape, IShape shape)
         {
             svgShape.setId(String.format("shape-%d", m_shapeIndex++));
             m_portionIndex = m_tspanIndex = 0;
         }
         public void formatText(ISvgTSpan svgTSpan, IPortion portion, ITextFrame textFrame)
         {
             int paragraphIndex = 0; int portionIndex = 0;
             for (int i = 0; i < textFrame.getParagraphs().getCount(); i++)
             {
                 portionIndex = textFrame.getParagraphs().get_Item(i).getPortions().indexOf(portion);
                 if (portionIndex > -1) { paragraphIndex = i; break; }
             }
             if (m_portionIndex != portionIndex)
             {
                 m_tspanIndex = 0;
                 m_portionIndex = portionIndex;
             }
             svgTSpan.setId(String.format("paragraph-%d_portion-%d_%d", paragraphIndex, m_portionIndex, m_tspanIndex++));
         }
     }
     
    • Method Detail

      • formatText

        void formatText(ISvgTSpan svgTSpan,
                        IPortion portion,
                        ITextFrame textFrame)

        This function is called before rendering of text portion to SVG to allow user to control resulting SVG.

        Parameters:
        svgTSpan - Object to control SVG tspan generation.
        portion - Source portion.
        textFrame - Source portion text frame.