Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public enum Document.Format

  1. Object
  2. Enum<Document.Format>
  3. Document.Format

ImplementsComparable<Document.Format>

The file formats read and write understand.

Enum constants

NATIVECodename One’s own .cn1doc: a ZIP holding document.xml.
TEXTPlain UTF-8 text.
HTMLHTML.
MARKDOWNMarkdown with GitHub tables.
DOCXOffice Open XML, the format of Word 2007 and later.
ODTOpenDocument text, the format of LibreOffice Writer.
RTFRich Text Format.
DOCThe binary format of Word 97 to 2003.
PDFPDF, laid out into pages as DocumentView shows them.

Methods

public static Document.Format[] values()
public static Document.Format valueOf(String name)
public String extension()The usual file extension, without the dot.
public static Document.Format forFileName(String fileName)The format a file name’s extension names.

Inherited methods

Enum constant details

NATIVE

NATIVE
Codename 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

TEXT
Plain UTF-8 text. Formatting and every page feature are lost; tables become tab separated lines.

HTML

HTML
HTML. 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

MARKDOWN
Markdown with GitHub tables. Like HTML it keeps no page features: sections, columns, headers, footers, text wrap, tab stops and column widths are dropped.

DOCX

DOCX
Office 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

ODT
OpenDocument 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

RTF
Rich 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

DOC
The 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.

PDF

PDF
PDF, 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

fileName String
a file name or path

Returns

the format, or null when the extension is not one of these