Convierta el formato JSON a PPTM en Android

Analice el formato JSON a PPTM en aplicaciones de Android sin utilizar Microsoft® PowerPoint

 

Puede convertir el formato JSON a PPTM en sus aplicaciones de Android en un proceso de dos pasos. En primer lugar, al usar Aspose.Cells for Android via Java , puede analizar JSON a PPTX. Después de eso, usando Aspose.Slides for Android via Java , puede convertir PPTX a PPTM. Ambas API se incluyen en el paquete Aspose.Total for Android via Java .

Convierta el formato JSON a PPTM en Android

  1. Cree un nuevo objeto Workbook y abra el archivo JSON
  2. Guarde JSON como PPTX usando save método
  3. Cargue el documento PPTX usando la clase Presentación
  4. Guarde el documento en formato PPTM utilizando el método save

Requisitos de conversión

Puede usar fácilmente Aspose.Total for Android via Java directamente desde Maven

Alternativamente, puede obtener un archivo ZIP de descargas .

// open JSON file using Workbook object
Workbook workbook = new Workbook("input.json");
// save resultant file in JSON-TO-PPTX ormat
workbook.save("pptxOutput.pptx", SaveFormat.AUTO);
// instantiate a Presentation object that represents a PPTX file
Presentation presentation = new Presentation("pptxOutput.pptx");
// supports PPT, POT, PPS, POTX, PPSX, PPTM, PPSM, POTM, ODP, and OTP file formats
// save the presentation as PPT
presentation.save("output.ppt", com.aspose.slides.SaveFormat.AUTO);

Establezca el diseño y convierta el formato JSON a PPTM en aplicaciones de Android

Además, la API le permite analizar JSON a PPTM con opciones de diseño específicas. Para especificar las opciones de diseño, puede usar la clase JsonLayoutOptions . Le permite procesar una matriz como una tabla, ignorar nulos, ignorar el título de la matriz, ignorar el título del objeto, convertir una cadena en un número o fecha, establecer el formato de fecha y número y establecer el estilo del título. Todas estas opciones le permiten presentar sus datos según sus necesidades. El siguiente fragmento de código le muestra cómo configurar las opciones de diseño.

// create a blank Workbook object
Workbook workbook = new Workbook("input.json");
// access default empty worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);
// read JSON file
String jsonInput = new String(Files.readAllBytes("SampleJson.json"));
// set JsonLayoutOptions for formatting
JsonLayoutOptions layoutOptions = new JsonLayoutOptions();
layoutOptions.setArrayAsTable(true);
layoutOptionssetConvertNumericOrDate(true);
layoutOptionssetIgnoreArrayTitle(true);
layoutOptionssetIgnoreNull(true);
layoutOptionssetIgnoreObjectTitle(true);
// import JSON data to default worksheet starting at cell A1
JsonUtility.importData(jsonInput, worksheet.getCells(), 0, 0, layoutOptions);
// save resultant file in JSON-TO-PPTX ormat
workbook.save("pptxOutput.pptx", SaveFormat.AUTO);
// instantiate a Presentation object that represents a PPTX file
Presentation presentation = new Presentation("pptxOutput.pptx");
// supports PPT, POT, PPS, POTX, PPSX, PPTM, PPSM, POTM, ODP, and OTP file formats
// save the presentation as PPT
presentation.save("output.ppt", com.aspose.slides.SaveFormat.AUTO);

Convierta el formato JSON a PPTM con marca de agua en Android a través de Java

Usando la API, también puede convertir JSON a PPTM con marca de agua. Para agregar una marca de agua a su documento PPTM, primero puede analizar JSON a PPTX y agregarle una marca de agua. Para agregar una marca de agua, cargue el archivo PPTX recién creado usando la clase Presentation , recorra todas las diapositivas, agregue texto usando addTextFrame, configure todas las opciones relevantes como color, tipo de relleno y más y puede guardar el documento en PPTM.

// open JSON file using Workbook object
Workbook workbook = new Workbook("input.json");
// save resultant file in JSON-TO-PPTX ormat
workbook.save("pptxOutput.pptx", SaveFormat.AUTO);
// instantiate a Presentation object that represents a PPTX file
Presentation presentation = new Presentation("pptxOutput.pptx");
for(ISlide slide:pres.getSlides()){
IAutoShape ashp = slide.getShapes()
.addAutoShape(ShapeType.Rectangle,50, 50, 500, 500);
ashp.addTextFrame("Watermark Text");
ashp.getTextFrame().getParagraphs().get_Item(0).getPortions()
.get_Item(0).getPortionFormat().getFillFormat()
.setFillType(FillType.Solid);
ashp.getTextFrame().getParagraphs().get_Item(0).getPortions()
.get_Item(0).getPortionFormat().getFillFormat()
.getSolidFillColor().setColor(Color.GRAY);
ashp.getTextFrame().getParagraphs().get_Item(0).getPortions()
.get_Item(0).getPortionFormat().setFontHeight(25);
// Change the line color of the rectangle to White
ashp.getShapeStyle().getLineColor().setColor(Color.WHITE);
ashp.getShapeStyle().setLineStyleIndex(LineStyle.ThinThin);
// Remove any fill formatting in the shape
ashp.getFillFormat().setFillType(FillType.NoFill);
ashp.setRotation(-45);
ashp.getAutoShapeLock().setSelectLocked(true);
ashp.getAutoShapeLock().setSizeLocked(true);
ashp.getAutoShapeLock().setTextLocked(true);
ashp.getAutoShapeLock().setPositionLocked(true);
ashp.getAutoShapeLock().setGroupingLocked(true);
}
// supports PPT, POT, PPS, POTX, PPSX, PPTM, PPSM, POTM, ODP, and OTP file formats
// save the presentation as PPT
presentation.save("output.ppt", com.aspose.slides.SaveFormat.AUTO);

Explore JSON opciones de conversión con Android

Convertir JSONs a CHM (Archivo de ayuda HTML compilado)
Convertir JSONs a DOC (Formato binario de Microsoft Word)
Convertir JSONs a DOCM (Archivo Marco de Microsoft Word 2007)
Convertir JSONs a DOT (Archivos de plantilla de Microsoft Word)
Convertir JSONs a DOTX (Archivo de plantilla de Microsoft Word)
Convertir JSONs a EPUB (Abrir archivo de libro electrónico)
Convertir JSONs a FLATOPC (Microsoft Word 2003 WordprocessingML)
Convertir JSONs a MOBI (Formato de libro electrónico abierto)
Convertir JSONs a ODP (Formato de presentación de OpenDocument)
Convertir JSONs a ODT (Formato de archivo de texto de OpenDocument)
Convertir JSONs a OTP (Formato estándar de OpenDocument)
Convertir JSONs a OTT (Plantilla de documento abierto)
Convertir JSONs a PCL (Lenguaje de comandos de la impresora)
Convertir JSONs a POT (Archivos de plantilla de Microsoft PowerPoint)
Convertir JSONs a POTM (Archivo de plantilla de Microsoft PowerPoint)
Convertir JSONs a POTX (Presentación de plantilla de Microsoft PowerPoint)
Convertir JSONs a POWERPOINT (Archivos de presentación)
Convertir JSONs a PPS (Presentación de diapositivas de PowerPoint)
Convertir JSONs a PPSM (Presentación de diapositivas habilitada para macros)
Convertir JSONs a PPSX (Presentación de diapositivas de PowerPoint)
Convertir JSONs a PPT (Presentación de Powerpoint)
Convertir JSONs a PS (Archivo PostScript)
Convertir JSONs a RTF (Formato de texto enriquecido)
Convertir JSONs a WORD (Formatos de archivo de procesamiento de textos)
Convertir JSONs a WORDML (Microsoft Word 2003 WordprocessingML)