備註
Contents
[
Hide
]
示範如何使用 Aspose.Slides for PHP via Java 來新增、讀取、移除和更新備註投影片。
新增備註投影片
建立備註投影片並為其指派文字。
function addNote() {
$presentation = new Presentation();
try {
$slide = $presentation->getSlides()->get_Item(0);
$notesSlide = $slide->getNotesSlideManager()->addNotesSlide();
$notesSlide->getNotesTextFrame()->setText("My note");
$presentation->save("note.pptx", SaveFormat::Pptx);
} finally {
$presentation->dispose();
}
}
存取備註投影片
從現有的備註投影片中讀取文字。
function accessNote() {
$presentation = new Presentation("note.pptx");
try {
$slide = $presentation->getSlides()->get_Item(0);
$notesSlide = $slide->getNotesSlideManager()->getNotesSlide();
$notes = $notesSlide->getNotesTextFrame()->getText();
} finally {
$presentation->dispose();
}
}
移除備註投影片
移除與投影片關聯的備註投影片。
function removeNote() {
$presentation = new Presentation("note.pptx");
try {
$slide = $presentation->getSlides()->get_Item(0);
$slide->getNotesSlideManager()->removeNotesSlide();
$presentation->save("note_removed.pptx", SaveFormat::Pptx);
} finally {
$presentation->dispose();
}
}
更新備註文字
變更備註投影片的文字。
function updateNoteText() {
$presentation = new Presentation("note.pptx");
try {
$slide = $presentation->getSlides()->get_Item(0);
$notesSlide = $slide->getNotesSlideManager()->getNotesSlide();
$notesSlide->getNotesTextFrame()->setText("Updated");
$presentation->save("note_updated.pptx", SaveFormat::Pptx);
} finally {
$presentation->dispose();
}
}