Sección
Contents
[
Hide
]
Ejemplos de cómo gestionar secciones de una presentación—agregar, acceder, eliminar y renombrar programáticamente usando Aspose.Slides for Java.
Agregar una sección
Crea una sección que comience en una diapositiva específica.
static void addSection() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
// Especifica la diapositiva que marca el comienzo de la sección.
presentation.getSections().addSection("New Section", slide);
} finally {
presentation.dispose();
}
}
Acceder a una sección
Lee la información de la sección de una presentación.
static void accessSection() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
presentation.getSections().addSection("My Section", slide);
// Acceder a una sección por índice.
ISection section = presentation.getSections().get_Item(0);
String sectionName = section.getName();
} finally {
presentation.dispose();
}
}
Eliminar una sección
Elimina una sección añadida previamente.
static void removeSection() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
ISection section = presentation.getSections().addSection("Temporary Section", slide);
// Elimina la primera sección.
presentation.getSections().removeSection(section);
} finally {
presentation.dispose();
}
}
Renombrar una sección
Cambia el nombre de una sección existente.
static void renameSection() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
presentation.getSections().addSection("Old Name", slide);
ISection section = presentation.getSections().get_Item(0);
section.setName("New Name");
} finally {
presentation.dispose();
}
}