笔记
Contents
[
Hide
]
本文演示如何使用 Aspose.Slides for Java 添加、读取、删除和更新备注幻灯片。
添加备注幻灯片
创建备注幻灯片并为其分配文本。
static void addNote() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
INotesSlide notesSlide = slide.getNotesSlideManager().addNotesSlide();
slide.getNotesSlideManager().getNotesSlide().getNotesTextFrame().setText("My note");
} finally {
presentation.dispose();
}
}
访问备注幻灯片
读取现有备注幻灯片中的文本。
static void accessNote() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
INotesSlide notesSlide = slide.getNotesSlideManager().addNotesSlide();
String notes = notesSlide.getNotesTextFrame().getText();
} finally {
presentation.dispose();
}
}
删除备注幻灯片
删除与幻灯片关联的备注幻灯片。
static void removeNote() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
INotesSlide notesSlide = slide.getNotesSlideManager().addNotesSlide();
slide.getNotesSlideManager().removeNotesSlide();
} finally {
presentation.dispose();
}
}
更新备注文本
更改备注幻灯片的文本。
static void updateNoteText() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
INotesSlide notesSlide = slide.getNotesSlideManager().addNotesSlide();
slide.getNotesSlideManager().getNotesSlide().getNotesTextFrame().setText("Old");
slide.getNotesSlideManager().getNotesSlide().getNotesTextFrame().setText("Updated");
} finally {
presentation.dispose();
}
}