static void Main()
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        var presentation = new PresentationDocument();

        // Create new slide.
        var slide = presentation.Slides.AddNew(SlideLayoutType.Custom);

        // Create new text box.
        var textBox = slide.Content.AddTextBox(
            ShapeGeometryType.RoundedRectangle, 2, 2, 10, 4, LengthUnit.Centimeter);

        // Create new paragraph.
        var paragraph = textBox.AddParagraph();

        // Set paragraph text.
        paragraph.AddRun("This paragraph has the following properties: alignment is justify, after spacing is 100% of the text size, before spacing is 250% of the text size, line spacing is 200% of the text size.");

        // Set selected paragraph format.
        var format = paragraph.Format;

        format.Alignment     = HorizontalAlignment.Justify;
        format.SpacingAfter  = TextSpacing.Single;
        format.SpacingBefore = TextSpacing.Multiple(2.5);
        format.SpacingLine   = TextSpacing.Double;

        // Create new paragraph.
        paragraph = textBox.AddParagraph();

        // Set paragraph text.
        paragraph.AddRun("This paragraph has the following properties: alignment is left, indentation before text is 15 points and first line indentation is 25 points.");

        // Set selected paragraph format.
        paragraph.Format.Alignment             = HorizontalAlignment.Left;
        paragraph.Format.IndentationBeforeText = Length.From(15, LengthUnit.Point);
        paragraph.Format.IndentationSpecial    = Length.From(25, LengthUnit.Point);

        presentation.Save("Paragraph Formatting.pptx");
    }
Esempio n. 2
0
    private static void SetImageBtnLabel(GameObject btn, string labelStr)
    {
        if ((labelStr != null) && btn.gameObject.activeSelf)
        {
            Text componentInChildren = btn.GetComponentInChildren <Text>();

            if (componentInChildren != null)
            {
                TextSpacing spce = componentInChildren.gameObject.AddMissingComponent <TextSpacing>();
                if (labelStr.Length > 2)
                {
                    spce.TxtSpacing = 0;
                }
                else
                {
                    spce.TxtSpacing = 30;
                }
                componentInChildren.text = labelStr;
            }
        }
    }
Esempio n. 3
0
 protected override void OnEnable()
 {
     text      = GetComponent <Text>();
     rt        = GetComponent <RectTransform>();
     textSpace = gameObject.CheckAddComponent <TextSpacing>();
 }