Aspose.Total for Android via Java aracılığıyla iki aşamalı bir işlemle POWERPOINT dosyasını Android uygulamalarınızda kolayca JSON’ye dönüştürebilirsiniz. İlk adımda, Aspose.Slides for Android via Java kullanarak POWERPOINT dosyasını HTML’ye aktarabilirsiniz. İkinci olarak, Aspose.Cells for Android via Java kullanarak HTML’yi JSON’ye dönüştürebilirsiniz.
Android'de POWERPOINT'u JSON'ye Dönüştürme
Dönüşüm Gereksinimleri
POWERPOINT’u JSON’ye dönüştürmek için Aspose.Total for Android’i Java aracılığıyla doğrudan Maven kullanabilirsiniz. /aspose/aspose-total) ve uygulamanıza kitaplıkları kurun.
Alternatif olarak, downloads adresinden bir ZIP dosyası alabilirsiniz.
// supports PPT, POT, PPS, POTX, PPSX, PPTM, PPSM, POTM, ODP, and OTP input file formats | |
// instantiate a Presentation object that represents a PPT file | |
Presentation presentation = new Presentation("template.ppt"); | |
// save the presentation as HTML | |
presentation.save("output.html", SaveFormat.Html); | |
// load the HTML file in an instance of Workbook | |
Workbook book = new Workbook("output.html"); | |
// save HTML as JSON | |
book.save("output.json", SaveFormat.JSON); |
Java aracılığıyla Android'de Korumalı POWERPOINT'u JSON'ye dönüştürün
API’yi kullanarak parola korumalı belgeyi de açabilirsiniz. Giriş POWERPOINT belgeniz parola korumalıysa, parolayı kullanmadan JSON’ye dönüştüremezsiniz. API, bir LoadOptions nesnesinde doğru parolayı ileterek şifrelenmiş belgeyi açmanıza olanak tanır. Aşağıdaki kod örneği, şifreli bir belgeyi parola ile açmanın nasıl deneneceğini gösterir:
// initialize load options | |
LoadOptions loadOptions = new LoadOptions(); | |
// set password | |
loadOptions.setPassword("123123"); | |
// supports PPT, POT, PPS, POTX, PPSX, PPTM, PPSM, POTM, ODP, and OTP input file formats | |
Presentation presentation = new Presentation("pres.pptx", loadOptions); | |
// save the presentation as HTML | |
presentation.save("output.html", SaveFormat.Html); | |
// load the HTML file in an instance of Workbook | |
Workbook book = new Workbook("output.html"); | |
// save HTML as JSON | |
book.save("output.json", SaveFormat.JSON); |
Android'de Filigran ile POWERPOINT Dosyasını JSON'ye Dönüştürün
POWERPOINT dosyasını JSON’ye dönüştürürken, çıktı JSON dosya biçiminize filigran da ekleyebilirsiniz. Filigran eklemek için dönüştürülen HTML dosyasını açmak için yeni bir Çalışma Kitabı oluşturun. Dizini aracılığıyla Çalışma Sayfası’nı seçin, bir Şekil oluşturun ve addTextEffect işlevini kullanın, renkleri, şeffaflığı ve daha fazlasını ayarlayın. Bundan sonra HTML belgenizi Filigranlı JSON olarak kaydedebilirsiniz.
// supports PPT, POT, PPS, POTX, PPSX, PPTM, PPSM, POTM, ODP, and OTP input file formats | |
// instantiate a Presentation object that represents a PPT file | |
Presentation presentation = new Presentation("template.ppt"); | |
// save the presentation as HTML | |
presentation.save("output.html", SaveFormat.Html); | |
// load the HTML file in an instance of Workbook | |
Workbook book = new Workbook("output.html"); | |
// access CellsCollection of the worksheet containing data to be converted | |
Cells cells = workbook.getWorksheets().get(0).getCells(); | |
// create & set ExportRangeToJsonOptions for advanced options | |
ExportRangeToJsonOptions exportOptions = new ExportRangeToJsonOptions(); | |
// create a range of cells containing data to be exported | |
Range range = cells.createRange(0, 0, cells.getLastCell().getRow() + 1, cells.getLastCell().getColumn() + 1); | |
// export range as JSON data | |
String jsonData = JsonUtility.exportRangeToJson(range, exportOptions); | |
// write data to disc in JSON format | |
BufferedWriter writer = new BufferedWriter(new FileWriter("output.json")); | |
writer.write(jsonData); | |
writer.close(); |