Click or drag to resize

DocumentSplitCriteria Enumeration

Specifies how the document is split into parts when saving to Html or Epub format.

Namespace:  Aspose.Words.Saving
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
[FlagsAttribute]
public enum DocumentSplitCriteria
Members
  Member nameValueDescription
None0 The document is not split.
PageBreak1 The document is split into parts at explicit page breaks. A page break can be specified by a PageBreak character, a section break specifying start of new section on a new page, or a paragraph that has its PageBreakBefore property set to true.
ColumnBreak2 The document is split into parts at column breaks. A column break can be specified by a ColumnBreak character or a section break specifying start of new section in a new column.
SectionBreak4 The document is split into parts at a section break of any type.
HeadingParagraph8 The document is split into parts at a paragraph formatted using a heading style Heading 1, Heading 2 etc. Use together with DocumentSplitHeadingLevel to specify the heading levels (from 1 to the specified level) at which to split.
Remarks

DocumentSplitCriteria is a set of flags which can be combined. For instance you can split the document at page breaks and heading paragraphs in the same export operation.

Different criteria can partially overlap. For instance, Heading 1 style is frequently given PageBreakBefore property so it falls under two criteria: PageBreak and HeadingParagraph. Some section breaks can cause page breaks and so on. In typical cases specifying only one flag is the most practical option.

Examples
Converts a document to EPUB with save options specified.
// Open an existing document from disk
Document doc = new Document(MyDir + "Rendering.docx");

// Create a new instance of HtmlSaveOptions. This object allows us to set options that control
// how the output document is saved
HtmlSaveOptions saveOptions = new HtmlSaveOptions();

// Specify the desired encoding.
saveOptions.Encoding = Encoding.UTF8;

// Specify at what elements to split the internal HTML at. This creates a new HTML within the EPUB 
// which allows you to limit the size of each HTML part. This is useful for readers which cannot read 
// HTML files greater than a certain size e.g 300kb
saveOptions.DocumentSplitCriteria = DocumentSplitCriteria.HeadingParagraph;

// Specify that we want to export document properties
saveOptions.ExportDocumentProperties = true;

// Specify that we want to save in EPUB format
saveOptions.SaveFormat = SaveFormat.Epub;

// Export the document as an EPUB file
doc.Save(ArtifactsDir + "Document.Doc2EpubSaveOptions.epub", saveOptions);
See Also