public class DocumentSplitCriteria
extends java.lang.Object
SaveFormat.HTML, SaveFormat.EPUB or SaveFormat.AZW_3 format.
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 ParagraphFormat.getPageBreakBefore() / ParagraphFormat.setPageBreakBefore(boolean) property so it falls under two criteria: PAGE_BREAK and HEADING_PARAGRAPH. Some section breaks can cause page breaks and so on. In typical cases specifying only one flag is the most practical option.
Examples:
Shows how to use a specific encoding when saving a document to .epub.
Document doc = new Document(getMyDir() + "Rendering.docx");
// Use a SaveOptions object to specify the encoding for a document that we will save.
HtmlSaveOptions saveOptions = new HtmlSaveOptions();
saveOptions.setSaveFormat(SaveFormat.EPUB);
saveOptions.setEncoding(StandardCharsets.UTF_8);
// By default, an output .epub document will have all of its contents in one HTML part.
// A split criterion allows us to segment the document into several HTML parts.
// We will set the criteria to split the document into heading paragraphs.
// This is useful for readers who cannot read HTML files more significant than a specific size.
saveOptions.setDocumentSplitCriteria(DocumentSplitCriteria.HEADING_PARAGRAPH);
// Specify that we want to export document properties.
saveOptions.setExportDocumentProperties(true);
doc.save(getArtifactsDir() + "HtmlSaveOptions.Doc2EpubSaveOptions.epub", saveOptions);
| Modifier and Type | Field and Description |
|---|---|
static int |
COLUMN_BREAK
The document is split into parts at column breaks.
|
static int |
HEADING_PARAGRAPH
The document is split into parts at a paragraph formatted using a heading style Heading 1, Heading 2 etc.
|
static int |
length |
static int |
NONE
The document is not split.
|
static int |
PAGE_BREAK
The document is split into parts at explicit page breaks.
|
static int |
SECTION_BREAK
The document is split into parts at a section break of any type.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String documentSplitCriteriaName) |
static int |
fromNames(java.util.Set documentSplitCriteriaNames) |
static java.lang.String |
getName(int documentSplitCriteria) |
static java.util.Set |
getNames(int documentSplitCriteria) |
static int[] |
getValues() |
static java.lang.String |
toString(int documentSplitCriteria) |
static java.lang.String |
toStringSet(int attr) |
public static int NONE
public static int PAGE_BREAK
ControlChar.PAGE_BREAK character, a section break specifying start of new section on a new page, or a paragraph that has its ParagraphFormat.getPageBreakBefore() / ParagraphFormat.setPageBreakBefore(boolean) property set to true.public static int COLUMN_BREAK
ControlChar.COLUMN_BREAK character or a section break specifying start of new section in a new column.public static int SECTION_BREAK
public static int HEADING_PARAGRAPH
HtmlSaveOptions.getDocumentSplitHeadingLevel() / HtmlSaveOptions.setDocumentSplitHeadingLevel(int) to specify the heading levels (from 1 to the specified level) at which to split.public static int length
public static java.lang.String getName(int documentSplitCriteria)
public static java.util.Set getNames(int documentSplitCriteria)
public static java.lang.String toString(int documentSplitCriteria)
public static java.lang.String toStringSet(int attr)
public static int fromName(java.lang.String documentSplitCriteriaName)
public static int fromNames(java.util.Set documentSplitCriteriaNames)
public static int[] getValues()