Xuất tệp phương tiện sang tệp HTML

Để xuất tệp phương tiện ra HTML, vui lòng thực hiện các bước bên dưới:

  • Tạo một thể hiện của lớp Presentation
  • Lấy tham chiếu của slide
  • Đặt hiệu ứng chuyển tiếp
  • Ghi bài thuyết trình dưới dạng tệp PPTX

Trong ví dụ dưới đây, chúng tôi đã xuất các tệp phương tiện sang HTML.

Ví dụ


 string FilePath = @"..\..\..\Sample Files\";

string srcFileName = FilePath + "Conversion.pptx";

string destFileName =  "video.html";

//Tải trình chiếu

using (Presentation pres = new Presentation(srcFileName))

{

    const string baseUri = "http://www.example.com/";

    VideoPlayerHtmlController controller = new VideoPlayerHtmlController(path: FilePath, fileName: destFileName, baseUri: baseUri);

    //Cài đặt tùy chọn HTML

    HtmlOptions htmlOptions = new HtmlOptions(controller);

    SVGOptions svgOptions = new SVGOptions(controller);

    htmlOptions.HtmlFormatter = HtmlFormatter.CreateCustomFormatter(controller);

    htmlOptions.SlideImageFormat = SlideImageFormat.Svg(svgOptions);

    //Lưu tệp

    pres.Save(destFileName, SaveFormat.Html, htmlOptions);

}

Tải mã mẫu

Tải ví dụ chạy