Class Stringifier

java.lang.Object
pro.verron.officestamper.test.Stringifier

public class Stringifier extends Object
Since:
1.6.5
Version:
${version}
Author:
Joseph Verron
  • Constructor Summary

    Constructors
    Constructor
    Description
    Stringifier(Supplier<org.docx4j.openpackaging.packages.WordprocessingMLPackage> documentSupplier)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Converts the given object into its string representation based on its type.
    static String
    stringifyExcel(org.docx4j.openpackaging.packages.SpreadsheetMLPackage presentation)
    Converts the content of a SpreadsheetMLPackage into a string by extracting and formatting cell data from the Excel file.
    static String
    stringifyPowerpoint(org.docx4j.openpackaging.packages.PresentationMLPackage presentation)
    Converts the content of a PowerPoint presentation into a string by extracting text paragraphs from the presentation and formatting them as strings.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Stringifier

      public Stringifier(Supplier<org.docx4j.openpackaging.packages.WordprocessingMLPackage> documentSupplier)
      Since:
      1.6.6
  • Method Details

    • stringifyPowerpoint

      public static String stringifyPowerpoint(org.docx4j.openpackaging.packages.PresentationMLPackage presentation)
      Converts the content of a PowerPoint presentation into a string by extracting text paragraphs from the presentation and formatting them as strings.
      Parameters:
      presentation - the PowerPoint presentation represented as a PresentationMLPackage.
      Returns:
      a string representation of the text content within the PowerPoint presentation.
    • stringifyExcel

      public static String stringifyExcel(org.docx4j.openpackaging.packages.SpreadsheetMLPackage presentation)
      Converts the content of a SpreadsheetMLPackage into a string by extracting and formatting cell data from the Excel file.
      Parameters:
      presentation - the Excel file represented as a SpreadsheetMLPackage
      Returns:
      a string representation of the cell content within the Excel spreadsheet
    • stringify

      public String stringify(Object o)
      Converts the given object into its string representation based on its type. The method supports various object types and applies the appropriate logic to stringify the content. For unsupported object types, an exception is thrown.
      Parameters:
      o - the object to be converted into a string representation. It supports specific types including JAXBElement, WordprocessingMLPackage, Tbl, Tr, Tc, MainDocumentPart, Body, List, Text, P, R, Drawing, Inline, Graphic, and other types defined in the method. Passing null or unsupported types will result in an exception.
      Returns:
      the string representation of the provided object. For some specific types like R.LastRenderedPageBreak or CTMarkupRange, an empty string may be returned. For objects like R.Tab or R.Cr, specific strings such as tab or carriage return characters may be returned. In case of unsupported types or null, an exception is thrown.