.NET을 사용하여 PowerPoint를 HTML 파일로 변환하는 방법
물론 COM 구성 요소를 사용해야하므로 먼저 PowerPoint2000을 설치하고 VS.NET에 알림을 추가하고 Microsoft PowerPoint Object Library 9.0을 찾아 추가해야합니다.
그런 다음 다음 코드를 작성하십시오. 매우 간단합니다. 설명 할 필요가 없습니다 :)
시스템 사용;
사무실 사용;
PowerPoint 사용;
네임 스페이스 코스 서버
{
/// <요약>
/// 저자 : Wang Hongchao
/// 버전 : 1.0
/// 날짜 : 2001/6/9
/// 설명 : PowerPoint의 PPT 파일을 HTML 파일로 변환
/// </summary>
공개 클래스 ConvertPowerPoint
{
/// <요약>
/// powerpoint.application의 com 구성 요소에 대한 참조 생성
/// </summary>
개인 PowerPoint.application ppt;
/// <요약>
/// 특정 파일을 가리 키십시오.
/// </summary>
개인 PowerPoint.pptfile.
개인 문자열 _htmlfilename;
/// <요약>
/// 속성을 쓰고 저장된 html 파일의 파일 경로를 설정합니다.
/// </summary>
공개 문자열 htmlfilename
{
세트
{
_htmlfilename = value;
}
}
/// <요약>
/// 생성자
/// </summary>
public convertpowerpoint ()
{
//
// TODO : 여기에 생성자 로직을 추가하십시오
//
ppt = new PowerPoint.application ();
}
/// <요약>
/// 변환 프로세스
/// </summary>
/// <param name = pptfilename> 변환 할 파워 포인트 파일 이름 </param>
public void convert (String pptfilename)
{
pptfile = ppt.presentations.open (pptfilename, office.msotristate.msottrue, office.msotristate.msottrue, office.msotristate.msofalse);
pptfile.saveas (_htmlfilename, powerpoint.ppseveasfiletype.ppseaveashtml, office.msotristate.msoctrue);
pptfile.close ();
}
}
}