Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public enum Document.Format
- Object
- Enum<Document.Format>
- Document.Format
ImplementsComparable<Document.Format>
The file formats
read and write understand.Enum constants
NATIVE | Codename One’s own .cn1doc: a ZIP holding document.xml. |
TEXT | Plain UTF-8 text. |
HTML | HTML. |
MARKDOWN | Markdown with GitHub tables. |
DOCX | Office Open XML, the format of Word 2007 and later. |
ODT | OpenDocument text, the format of LibreOffice Writer. |
RTF | Rich Text Format. |
DOC | The binary format of Word 97 to 2003. |
PDF | PDF, laid out into pages as DocumentView shows them. |
Methods
Inherited methods
Enum constant details
NATIVE
NATIVECodename One’s own
.cn1doc: a ZIP holding document.xml. Keeps everything the
model holds, page features included: sections, columns, headers and footers,
floating pictures, tab stops, indents and table column widths. Files written by the
Codename One word processor open too; whatever they hold beyond this model is
skipped.TEXT
TEXTPlain UTF-8 text. Formatting and every page feature are lost; tables become tab
separated lines.
HTML
HTMLHTML. Reading accepts common markup, tables (with
colspan/rowspan) and
data: URI images; writing produces a complete page. A web page has no pages:
sections, columns, headers and footers are dropped and a floating picture is
written in the flow of the text.MARKDOWN
MARKDOWNMarkdown with GitHub tables. Like HTML it keeps no page features: sections,
columns, headers, footers, text wrap, tab stops and column widths are dropped.
DOCX
DOCXOffice Open XML, the format of Word 2007 and later. Reads and writes styles,
lists, tables with merged cells and column widths, pictures inline and floating
with text wrap, fields, notes, comments, tracked changes, sections with columns,
headers and footers, tab stops and indents; text boxes and charts are skipped.
ODT
ODTOpenDocument text, the format of LibreOffice Writer. Reads and writes styles,
lists, tables with spans and column widths, pictures inline and floating with text
wrap, notes, annotations, tracked changes, sections with columns (as master pages
and text sections), headers and footers, tab stops and indents.
RTF
RTFRich Text Format. Reads and writes character formatting, styles, lists, indents,
tab stops, tables
with merged cells, links, fields, notes, PNG and JPEG pictures, annotations and
tracked changes; nested tables are written as tab separated lines. Page features
are not written: sections, columns, headers and footers are dropped and floating
pictures are written inline.
DOC
DOCThe binary format of Word 97 to 2003. Read only: styles, lists, tables with merged
cells, pictures, fields, notes, comments and tracked changes are read; writing
throws, since files should be saved as DOCX.
PDFPDF, laid out into pages as
DocumentView shows them. Write only: reading throws.Method details
values
public static Document.Format[] values()valueOf
public static Document.Format valueOf(String name)extension
public String extension()The usual file extension, without the dot.
Returns
the extension
forFileName
public static Document.Format forFileName(String fileName)The format a file name’s extension names.
Parameters
fileNameString- a file name or path
Returns
the format, or null when the extension is not one of these