com.aspose.words

Class OoxmlCompliance

  • java.lang.Object
    • com.aspose.words.OoxmlCompliance
public class OoxmlCompliance 
extends java.lang.Object

Utility class containing constants. Allows to specify which OOXML specification will be used when saving in the DOCX format.

Example:

Shows conversion VML shapes to DML using ISO/IEC 29500:2008 Strict compliance level.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Set Word2003 version for document, for inserting image as VML shape
doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2003);
builder.insertImage(getImageDir() + "Transparent background logo.png");

Assert.assertEquals(ShapeMarkupLanguage.VML, ((Shape) doc.getChild(NodeType.SHAPE, 0, true)).getMarkupLanguage());

// Iso29500_2008 does not allow VML shapes
// You need to use OoxmlCompliance.Iso29500_2008_Strict for converting VML to DML shapes
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
saveOptions.setCompliance(OoxmlCompliance.ISO_29500_2008_STRICT);
saveOptions.setSaveFormat(SaveFormat.DOCX);

doc.save(getArtifactsDir() + "OoxmlSaveOptions.Iso29500Strict.docx", saveOptions);

// The markup language of our shape has changed according to the compliance type 
doc = new Document(getArtifactsDir() + "OoxmlSaveOptions.Iso29500Strict.docx");

Assert.assertEquals(ShapeMarkupLanguage.DML, ((Shape) doc.getChild(NodeType.SHAPE, 0, true)).getMarkupLanguage());

Field Summary
static final intECMA_376_2006 = 0
ECMA-376 1st Edition, 2006.
static final intISO_29500_2008_TRANSITIONAL = 1
ISO/IEC 29500:2008 Transitional compliance level.
static final intISO_29500_2008_STRICT = 2
ISO/IEC 29500:2008 Strict compliance level.
 

    • Field Detail

      • ECMA_376_2006 = 0

        public static final int ECMA_376_2006
        ECMA-376 1st Edition, 2006.
      • ISO_29500_2008_TRANSITIONAL = 1

        public static final int ISO_29500_2008_TRANSITIONAL
        ISO/IEC 29500:2008 Transitional compliance level.
      • ISO_29500_2008_STRICT = 2

        public static final int ISO_29500_2008_STRICT
        ISO/IEC 29500:2008 Strict compliance level.