com.aspose.words
Class OoxmlCompliance

java.lang.Object
    extended by 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 how to configure a list to restart numbering at each section.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

doc.getLists().add(ListTemplate.NUMBER_DEFAULT);

List list = doc.getLists().get(0);
list.isRestartAtEachSection(restartListAtEachSection);

// The "IsRestartAtEachSection" property will only be applicable when
// the document's OOXML compliance level is to a standard that is newer than "OoxmlComplianceCore.Ecma376".
OoxmlSaveOptions options = new OoxmlSaveOptions();
{
    options.setCompliance(OoxmlCompliance.ISO_29500_2008_TRANSITIONAL);
}

builder.getListFormat().setList(list);

builder.writeln("List item 1");
builder.writeln("List item 2");
builder.insertBreak(BreakType.SECTION_BREAK_NEW_PAGE);
builder.writeln("List item 3");
builder.writeln("List item 4");

doc.save(getArtifactsDir() + "OoxmlSaveOptions.RestartingDocumentList.docx", options);

doc = new Document(getArtifactsDir() + "OoxmlSaveOptions.RestartingDocumentList.docx");

Assert.assertEquals(restartListAtEachSection, doc.getLists().get(0).isRestartAtEachSection());

Example:

Shows how to set an OOXML compliance specification for a saved document to adhere to.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// If we configure compatibility options to comply with Microsoft Word 2003,
// inserting an image will define its shape using VML.
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());

// The "ISO/IEC 29500:2008" OOXML standard does not support VML shapes.
// If we set the "Compliance" property of the SaveOptions object to "OoxmlCompliance.Iso29500_2008_Strict",
// any document we save while passing this object will have to follow that standard. 
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
saveOptions.setCompliance(OoxmlCompliance.ISO_29500_2008_STRICT);
saveOptions.setSaveFormat(SaveFormat.DOCX);

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

// Our saved document defines the shape using DML to adhere to the "ISO/IEC 29500:2008" OOXML standard.
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.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.