В этой статье будет рассказано, как программно копировать слайды из одной презентации PowerPoint в другую с помощью бесплатного Spire. Презентация для Java.
Зависимость от импорта jar (2 метода) ● Загрузите бесплатную библиотеку и распакуйте ее. Затем добавьте Шпиль.Презентация.файл jar в ваш проект в качестве зависимости.
● Вы также можете добавить зависимость jar в свой проект maven, добавив следующие конфигурации в pom.xml .
com.e-iceblue e-iceblue http://repo.e-iceblue.com/nexus/content/groups/public/ e-iceblue spire.presentation.free 3.9.0
Пример Кода
import com.spire.presentation.FileFormat;
import com.spire.presentation.Presentation;
public class CopySlides {
public static void main(String[] args) throws Exception {
//Create a Presentation object to load the first document
Presentation pptOne= new Presentation();
pptOne.loadFromFile("test1.pptx");
//Create a Presentation object to load the second document
Presentation pptTwo = new Presentation();
pptTwo.loadFromFile("input1.pptx");
//Insert the specific slide of the first document to the specified position on the second document
pptTwo.getSlides().insert(1,pptOne.getSlides().get(0));
//Append the specific slide of the first document to the end of the second document
pptTwo.getSlides().append(pptOne.getSlides().get(2));
//Save the second document to file
pptTwo.saveToFile("CopySlides.pptx", FileFormat.PPTX_2013);
}
}
Оригинал: “https://dev.to/jazzzzz/copy-slides-from-one-presentation-to-another-using-java-3b20”