shapes_richtext.rst 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. .. _shapes_richtext:
  2. RichText
  3. ========
  4. Rich text shapes contain paragraphs of texts. To create a rich text shape, use ``createRichTextShape`` method of slide.
  5. Below are the properties that you can set for a rich text shape.
  6. - ``wrap``
  7. - ``autoFit``
  8. - ``fontScale`` : font scale (in percentage) when autoFit = RichText::AUTOFIT_NORMAL
  9. - ``lnSpcReduction`` : line spacing reduction (in percentage) when autoFit = RichText::AUTOFIT_NORMAL
  10. - ``horizontalOverflow``
  11. - ``verticalOverflow``
  12. - ``upright``
  13. - ``vertical``
  14. - ``columns``
  15. - ``bottomInset`` in pixels
  16. - ``leftInset`` in pixels
  17. - ``rightInset`` in pixels
  18. - ``topInset`` in pixels
  19. - ``autoShrinkHorizontal`` (boolean)
  20. - ``autoShrinkVertical`` (boolean)
  21. Properties that can be set for each paragraphs are as follow.
  22. - ``alignment`` see *[Alignment](#alignment)*
  23. - ``bulletStyle`` see *[Bullet](#bullet)*
  24. - ``lineSpacing`` see *[LineSpacing](#linespacing)*
  25. - ``font`` see *[Font](#font)*
  26. Bullet
  27. ------
  28. For a paragraph, you can define the bullet style.
  29. Example:
  30. .. code-block:: php
  31. use PhpOffice\PhpPresentation\Shape\RichText\Paragraph;
  32. use PhpOffice\PhpPresentation\Style\Bullet;
  33. $oParagraph = new Paragraph();
  34. $oParagraph->getBulletStyle();
  35. With the bullet style, you can define the char, the font, the color and the type.
  36. .. code-block:: php
  37. use PhpOffice\PhpPresentation\Shape\RichText\Paragraph;
  38. use PhpOffice\PhpPresentation\Style\Bullet;
  39. use PhpOffice\PhpPresentation\Style\Color;
  40. $oParagraph = new Paragraph();
  41. $oParagraph->getBulletStyle()->setBulletChar('-');
  42. $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET);
  43. $oParagraph->getBulletStyle()->setBulletColor(new Color(Color::COLOR_RED));
  44. LineSpacing
  45. -----------
  46. For a paragraph, you can define the line spacing.
  47. Example:
  48. .. code-block:: php
  49. use PhpOffice\PhpPresentation\Shape\RichText\Paragraph;
  50. $oParagraph = new Paragraph();
  51. $oParagraph->setLineSpacing(200);
  52. $iLineSpacing = $oParagraph->getLineSpacing();
  53. Run
  54. ---
  55. For a run, you can define the language.
  56. Example:
  57. .. code-block:: php
  58. use PhpOffice\PhpPresentation\Shape\RichText\Run;
  59. $oRun = new Run();
  60. $oRun->setLanguage('fr-FR');