Tutorial de elemento de diapositiva

This article was translated from English: Does it need improvement?
Translated
View the article in English

IronPPT es una robusta biblioteca de PowerPoint diseñada para ayudar a los desarrolladores de .NET C# a integrar sin problemas la capacidad de crear, leer y editar presentaciones de PowerPoint en sus aplicaciones. En el contexto de una presentación de PowerPoint, las diapositivas son los elementos fundamentales que estructuran y organizan el contenido.

Índice


Añadir texto

Contenido del texto

Tanto si estás creando una nueva presentación como si estás editando una existente, las herramientas de gestión de texto te brindan control total sobre la colocación y el formato del texto, permitiéndote diseñar diapositivas que transmitan tu mensaje de manera clara y profesional.

:path=/static-assets/ppt/content-code-examples/tutorials/slide-element-add-text.cs
using IronPPT;
using IronPPT.Models;

// Create new PowerPoint presentation
var document = new PresentationDocument();

// Add text
var text = document.Slides[0].AddText("Hello");

// Append text
text.Append(new Text(" There!"));

// Remove text
document.Slides[0].Texts[0].Remove();

// Export PowerPoint presentation
document.Save("addText.pptx");
Imports IronPPT
Imports IronPPT.Models

' Create new PowerPoint presentation
Private document = New PresentationDocument()

' Add text
Private text = document.Slides(0).AddText("Hello")

' Append text
text.Append(New Text(" There!"))

' Remove text
document.Slides(0).Texts(0).Remove()

' Export PowerPoint presentation
document.Save("addText.pptx")
VB   C#

Set Styling

El estilo del texto te permite personalizar su apariencia visual al definir atributos como el tamaño de la fuente, el color, el estilo, el tachado y el subrayado. Aplicar estos estilos mejora la presentación del texto y mejora el aspecto general del documento.

:path=/static-assets/ppt/content-code-examples/tutorials/slide-element-text-style.cs
using IronPPT;
using IronPPT.Models;
 
var document = new PresentationDocument();

// Customize text style
var textStyle = new TextStyle
{
    IsBold = true,
    IsItalic = true,
    Color = Color.Blue,
    Strike = StrikValue.SingleStrike,
    Outline = true,
    NoProof = true,
    Spacing = 10.0,
    Underline = new Underline { LineValue = UnderlineValues.Single, Color = Color.Red },
    Languages = "en-US",
    SpecVanish = false,
};

// Add style to text
var text = new Text("Hello World");
text.TextStyle = textStyle;

// Add text
document.Slides[0].AddText(text);

document.Save("textStyle.pptx");
Imports IronPPT
Imports IronPPT.Models

Private document = New PresentationDocument()

' Customize text style
Private textStyle = New TextStyle With {
	.IsBold = True,
	.IsItalic = True,
	.Color = Color.Blue,
	.Strike = StrikValue.SingleStrike,
	.Outline = True,
	.NoProof = True,
	.Spacing = 10.0,
	.Underline = New Underline With {
		.LineValue = UnderlineValues.Single,
		.Color = Color.Red
	},
	.Languages = "en-US",
	.SpecVanish = False
}

' Add style to text
Private text = New Text("Hello World")
text.TextStyle = textStyle

' Add text
document.Slides(0).AddText(text)

document.Save("textStyle.pptx")
VB   C#

Añadir imágenes

Ajustar la configuración de imagen para una visualización óptima. Una configuración adecuada asegura que las imágenes sean visualmente atractivas y apropiadas para su contexto.

:path=/static-assets/ppt/content-code-examples/tutorials/slide-element-add-image.cs
using IronPPT;
using IronPPT.Models;
 
// Create new PowerPoint presentation
var document = new PresentationDocument();
 
// Add image
Image image = new Image();
image.LoadFromFile("sample.png");
var newImage = document.AddImage(image, 0);
 
// Edit image's properties
newImage.Position = (200, 200);
newImage.Angle = 45;
newImage.Name = "new image";
newImage.Width = 150;
newImage.Height = 150;
 
// Export PowerPoint presentation
document.Save("addImage.pptx");
Imports IronPPT
Imports IronPPT.Models

' Create new PowerPoint presentation
Private document = New PresentationDocument()

' Add image
Private image As New Image()
image.LoadFromFile("sample.png")
Dim newImage = document.AddImage(image, 0)

' Edit image's properties
newImage.Position = (200, 200)
newImage.Angle = 45
newImage.Name = "new image"
newImage.Width = 150
newImage.Height = 150

' Export PowerPoint presentation
document.Save("addImage.pptx")
VB   C#

Añadir formas

Agrega y personaliza fácilmente formas en tu presentación definiendo su tipo y dimensiones(anchura y altura), colores de relleno y contorno, y posición en la diapositiva.

:path=/static-assets/ppt/content-code-examples/tutorials/slide-element-add-image.cs
using IronPPT;
using IronPPT.Models;
 
// Create new PowerPoint presentation
var document = new PresentationDocument();
 
// Add image
Image image = new Image();
image.LoadFromFile("sample.png");
var newImage = document.AddImage(image, 0);
 
// Edit image's properties
newImage.Position = (200, 200);
newImage.Angle = 45;
newImage.Name = "new image";
newImage.Width = 150;
newImage.Height = 150;
 
// Export PowerPoint presentation
document.Save("addImage.pptx");
Imports IronPPT
Imports IronPPT.Models

' Create new PowerPoint presentation
Private document = New PresentationDocument()

' Add image
Private image As New Image()
image.LoadFromFile("sample.png")
Dim newImage = document.AddImage(image, 0)

' Edit image's properties
newImage.Position = (200, 200)
newImage.Angle = 45
newImage.Name = "new image"
newImage.Width = 150
newImage.Height = 150

' Export PowerPoint presentation
document.Save("addImage.pptx")
VB   C#