이 문서에서는 C# REST API를 사용하여 PowerPoint에서 메모를 삭제하는 방법을 안내합니다. .NET 기반 클라우드 SDK를 사용하여 C# Low Code API를 사용하여 PowerPoint에서 모든 노트를 삭제하는 방법을 알아봅니다. 노트 슬라이드 삭제 후 노트 삭제 확인을 위한 샘플 코드를 제공합니다.
전제조건
다운로드 Aspose.Slides Cloud SDK for Dotnet to delete a note
메모 제거를 위해 위 SDK를 사용하여 C# 프로젝트 설정
C# REST API를 사용하여 PowerPoint에서 모든 메모를 제거하는 단계
- 메모 제거를 위한 자격 증명과 함께 SlidesApi 클래스를 사용하여 API 클라이언트 초기화
- UploadFile() 메서드를 사용하여 메모가 포함된 프레젠테이션을 업로드합니다.
- 업로드된 파일명과 대상 슬라이드 번호를 이용하여 DeleteNotesSlide() 메소드를 호출합니다.
- 대상 슬라이드에서 노트가 삭제되었음을 알리는 메시지 표시
- 메모를 삭제한 후 업데이트된 프레젠테이션을 다운로드하세요.
이 단계에서는 C# REST 인터페이스를 사용하여 PowerPoint에서 메모를 삭제하는 방법을 설명합니다. 대상 프레젠테이션을 클라우드 저장소에 업로드하고 파일 이름과 대상 슬라이드를 제공하여 DeleteNotesSlide() 메서드를 호출합니다. 프레젠테이션의 모든 슬라이드에 대해 이 과정을 반복하고 출력을 디스크에 저장합니다.
C# REST 인터페이스를 사용하여 PowerPoint에서 모든 메모를 삭제하는 코드
using Aspose.Slides.Cloud.Sdk; | |
using Aspose.Slides.Cloud.Sdk.Model; | |
using System; | |
using System.IO; | |
namespace PresentationModifier | |
{ | |
class SlideNotesRemover | |
{ | |
static void Main(string[] args) | |
{ | |
// Initialize the API client with credentials | |
var slidesApi = new SlidesApi("ID", "Secret"); | |
// Define the presentation file name | |
string presentationFile = "PresentationExample.pptx"; | |
// Upload the presentation to the server | |
var uploadResponse = slidesApi.UploadFile(presentationFile, new MemoryStream(File.ReadAllBytes(presentationFile))); | |
// Specify the slide number to modify (changed to slide 2) | |
int targetSlideNumber = 2; | |
// Remove the notes slide from the specified slide | |
Slide updatedSlide = slidesApi.DeleteNotesSlide(presentationFile, targetSlideNumber); | |
// Check if the notes slide exists after the operation | |
bool isNotesSlidePresent = updatedSlide.NotesSlide != null; | |
Console.WriteLine("Notes slide present: " + isNotesSlidePresent); | |
// Download the updated presentation from the server | |
Stream updatedFileStream = slidesApi.DownloadFile(presentationFile); | |
// Save the modified presentation locally | |
using (var fileStream = new FileStream("ModifiedPresentation.pptx", FileMode.Create, FileAccess.Write)) | |
{ | |
updatedFileStream.CopyTo(fileStream); | |
} | |
Console.WriteLine("Presentation updated and saved as 'ModifiedPresentation.pptx'."); | |
} | |
} | |
} |
이 코드는 C# REST 인터페이스를 사용하여 PowerPoint에서 메모를 삭제하는 방법을 보여줍니다. NotesSlide 플래그를 사용하여 노트 삭제 전후에 일부 슬라이드에 노트가 있는지 확인할 수 있습니다. 노트 슬라이드의 존재를 확인하려면 NotesSlideExists() 메서드를 사용하세요.
이 기사에서는 메모를 제거하는 방법을 배웠습니다. 프레젠테이션에 메모를 추가하려면 C# REST API를 사용하여 PowerPoint 슬라이드에 메모 추가의 문서를 참조하세요.