종종 개발자는 프로그래밍 방식으로 DOC 파일을 PPT로 변환해야 합니다. 파일 자동화 Java 라이브러리 Aspose.Total for Java 를 사용하여 몇 가지 간단한 단계로 렌더링 프로세스를 자동화할 수 있습니다. Aspose.Words for Java 를 사용하여 DOC 파일을 로드하고 HTML로 변환할 수 있습니다. 그 후 강력한 PowerPoint 조작 Java API Aspose.Slides for Java 를 사용하여 새 프레젠테이션을 만들고 HTML 콘텐츠를 작성하고 PPT로 저장할 수 있습니다. .
Java를 통해 DOC를 PPT로 변환 또는 온라인 앱하는 방법
- Document 클래스를 사용하여 DOC 파일을 엽니다.
- [save]( https://reference.aspose.com/words/java/com.aspose.words/Document#save(java.lang.String,com.aspose.words.SaveOptions) 을 사용하여 DOC 파일을 HTML로 변환합니다.)) 방법
- 새로운 Presentation 객체 초기화
- BufferedReader를 사용하여 HTML 파일에서 콘텐츠를 추출하고 프레젠테이션 파일에 콘텐츠를 작성합니다.
- save 메서드를 사용하여 문서를 PPT에 저장합니다.
변환 요구 사항
DOC에서 PPT로 파일 변환을 위해 [Maven]( https://repository.aspose.com/webapp/#/artifacts/browse/tree/General/repo/com/aspose 에서 직접 Java용 Aspose.Total을 쉽게 사용할 수 있습니다. /aspose-total) 기반 프로젝트를 만들고 pom.xml에 라이브러리를 포함합니다.
또는 다운로드 에서 ZIP 파일을 받을 수 있습니다.
// supports DOC, DOCX, DOT, DOTM, DOTX, FLATOPC, ODT, OTT, RTF, TXT, WORDML, DOCM input file formats | |
// load DOC file with an instance of Document | |
Document document = new Document("template.doc"); | |
// save the document in HTML file format | |
document.save("HtmlOutput.html",SaveFormat.HTML); | |
// create a new presentation | |
Presentation pres = new Presentation(); | |
// access the default first slide of presentation | |
ISlide slide = pres.getSlides().get_Item(0); | |
// add the AutoShape to accommodate the HTML content | |
IAutoShape ashape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 10, 10, | |
(float) pres.getSlideSize().getSize().getWidth(), | |
(float) pres.getSlideSize().getSize().getHeight()); | |
ashape.getFillFormat().setFillType(FillType.NoFill); | |
// add text frame to the shape | |
ashape.addTextFrame(""); | |
// clear all paragraphs in added text frame | |
ashape.getTextFrame().getParagraphs().clear(); | |
// initialize StringBuilder to read Html | |
StringBuilder contents = new StringBuilder(); | |
// load HTML file by using BufferedReader | |
BufferedReader reader = new BufferedReader(new FileReader(new File("HtmlOutput.html"))); | |
String text = null; | |
// repeat until all lines are read | |
while ((text = reader.readLine()) != null) { | |
contents.append(text).append(System.getProperty("line.separator")); | |
} | |
reader.close(); | |
// add HTML content in text frame | |
ashape.getTextFrame().getParagraphs().addFromHtml(content); | |
// supports POTM, POT, POTX, PPSM, PPS, PPSX, PPTM, PPT, PPTX, ODP output file formats. | |
// save presentation as Pptx | |
pres.save("output.pptx", com.aspose.slides.SaveFormat.Pptx); |
DOC를 PPT로 변환하는 무료 온라인 변환기
변환 요구 사항
API를 사용하면 암호로 보호된 DOC 문서를 PPT로 변환할 수도 있습니다. 입력한 DOC 문서가 비밀번호로 보호되어 있는 경우 비밀번호를 사용하지 않고는 PPT 형식으로 변환할 수 없습니다. 암호화된 문서를 열려면 LoadOptions 개체에 올바른 암호를 설정하고 이를 Document 생성자에 전달할 수 있습니다.
// supports DOC, DOT, DOCX, DOCM, DOTX, and DOTM file formats | |
// load DOC file with an instance of Document | |
Document document = new Document("template.doc", new LoadOptions("MyPassword")); | |
// save the document in HTML file format | |
document.save("HtmlOutput.html",SaveFormat.HTML); | |
// create a new presentation | |
Presentation pres = new Presentation(); | |
// perform the conversion to PPT |
자주 묻는 질문
- 어떻게 DOC를 PPT 온라인으로 변환할 수 있습니까?위에 통합된 온라인 앱을 사용하면 DOC 파일을 PPT로 변환할 수 있습니다. 시작하려면 흰색 영역 내부를 드래그 앤 드롭하거나 클릭하여 DOC 파일을 가져오십시오. 파일이 업로드되면 "변환" 버튼을 클릭합니다. DOC에서 PPT로 변환 프로세스가 완료되면 클릭 한 번으로 변환된 파일을 다운로드할 수 있습니다.
- DOC를 변환하는 데 얼마나 걸립니까?이 온라인 DOC 변환기는 빠르게 작동하지만 속도는 주로 변환하는 DOC 파일의 크기에 따라 달라집니다. 더 작은 DOC 파일은 단 몇 초 만에 PPT로 변환할 수 있습니다. 변환 코드를 Java 애플리케이션에 통합한 경우 변환 프로세스의 속도는 애플리케이션을 얼마나 잘 최적화했는지에 따라 달라집니다.
- 무료 Aspose.Total 변환기를 사용하여 DOC를 PPT로 변환하는 것이 안전합니까?물론! 변환이 완료되면 PPT 파일의 다운로드 링크를 즉시 사용할 수 있습니다. 업로드된 파일은 24시간 후에 삭제되며 해당 기간이 지나면 다운로드 링크가 더 이상 작동하지 않습니다. 귀하의 파일은 안전하며 아무도 파일에 액세스할 수 없습니다. 통합 앱은 주로 테스트 목적으로 무료이므로 코드를 통합하기 전에 결과를 확인할 수 있습니다.
- DOC를 변환하려면 어떤 브라우저를 사용해야 합니까?Google Chrome, Firefox, Opera 또는 Safari와 같은 최신 브라우저를 사용하여 이 온라인 변환을 수행할 수 있습니다. 그러나 데스크톱 애플리케이션을 구축하는 경우 Aspose.Total DOC Conversion API는 원활한 경험을 제공합니다.