Expand description
Public API of F-Office.
F-Office renders Office Open XML documents the way Microsoft Office does, starting with
Word’s DOCX format. This crate opens a file and lays it out into a display list, which
f-office-raster draws as pixels, or writes it as a PDF file. The other f-office-* crates
are internal and have no stability promise before 1.0.
Modules§
- configuration
- The configuration: the setup of Word’s machine and the user’s choice of fonts, and the types of its keys. The configuration: the setup of Word’s machine that changes its pages (its printer, its time zone, the separators of its numbers and its fonts) and the user’s choice of the family that draws a family on this computer, and nothing else. Word’s behaviors and numbers are the target’s profile, which no configuration sets.
- docx
- The warnings of the DOCX layout, which
Warning::Docxholds, and the types of their fields. - edit
- Edits of a DOCX file: a list of edits, made
all or none (
apply), each of which names the file as it was before the list. A raw edit names an element of any XML part by its path (XmlEdit); a named edit names a block of the body by its address (NamedEdit), and the DOCX crate makes it into splices of the main document part, and for a comment or an image also of the parts that it changes, with the parts that it adds (f_office_docx::named_edits). - The warnings of the PDF writer, which
Warning::Pdfholds.
Structs§
- Address
- The path by which a reader names an element of a story (Address):
p12for the twelfth paragraph of the body,t2/r4/c1/p1for the first paragraph of the first cell of the fourth row of the second table,t2/r4for that row,p5/b1/p2for the second paragraph of the first text box of the fifth paragraph, andh1/p3for the third paragraph of the first header part. Its grammar is - ArtPictures
- The pictures of the art page borders that a caller gives, by art style and size. An empty set,
the default, draws no art border: the layout leaves each side of an art style out, with a
warning (
crate::Warning::ArtBorderNotDrawn). - ArtPictures
Error - Why a file of art pictures does not read, and on which line.
- Cell
Place - The table cell that a placed line lies in, each number from 1.
- Configuration
- The configuration of a layout: the target, and the setup of Word’s machine and the fonts.
- Date
Time - A local date and time.
- Display
List - The pages of one rendered document.
- Document
- A DOCX file opened and laid out once for a target: its display list, which an output draws or
writes, the places of its lines, and the text blocks of its body. It holds no state of the
parse or the layout: what the layout left out or drew in another way comes out of
Document::openbeside it. - Fidelity
Report - Complete typed rendering fidelity report for a laid-out document.
- Font
Database - Font faces loaded from bytes, addressed by
FontId. - Font
Status - Resolution details for one font family requested by the document.
- Layout
Continuation - Resumable layout continuation driving remaining pages of an incrementally opened
Document. - Layout
Progress - Progress summary returned by
Document::begin_open_preparedandLayoutContinuation::step. - Length
- A length in half-EMUs, which is 1/25,400 of a point.
- Limits
- Limits that protect the reader against hostile packages: those of the ZIP file, and those of
each XML part, which the package keeps for the readers of its parts (
Package::limits). Start fromLimits::defaultand set the limits that differ, so that a new limit breaks no caller. - Line
Turn - How the upright frame of a turned line lies on the page (Line turn): a point of the
frame lands on the page at
to, plus its offset fromfromturned byturn. - Missing
Glyph Group - Missing (
.notdef) characters grouped by font and coarse Unicode block, with zero raw text. - Name
- A name that a file chooses and a warning keeps, such as a part’s name in its package or a
font family that a document asks for: at most
Name::MAX_CHARScharacters of it, without the characters that a terminal or a log does not show as themselves (control characters and the marks that change the direction or the joining of text). - Number
Separators - The decimal separator and the group separator that a machine writes in numbers, such as
.and,in1,234.5. - Number
Separators Error - A text that is no pair of number separators.
- Omission
- Counted summary of one category of rendering omission or approximation.
- Options
- Choices for opening a document that the document itself does not make. Start from
Options::defaultand set the fields that differ, so that a new field breaks no caller. The default lays out for the default target with its defaults. - Page
- One page.
- Prepared
Document - A DOCX file opened and parsed once, ready for fast font discovery and incremental layout.
- Story
Bookmark - A bookmark that starts in a paragraph’s story text (Story bookmark), at a byte of it.
- Story
Link - A hyperlink in a paragraph’s story text (Story link): the bytes of the text that show it, from its first to its last glyph, where it goes and its tooltip.
- Story
Paragraph - A paragraph of a story’s text (Story text): the texts of its laid out lines joined, so that a field gives its shown result, a list label is given as drawn, hidden text is left out and an automatic hyphen is not in it.
- Target
- The product whose pages a layout reproduces. The default target is Word for Windows
(
word-win). Preview targets (word-mac,word-web) are gated behind thepreview-targetsfeature. - Text
Block - A paragraph or a table of the body, as a reader of the document lists it (Text block).
- Text
Cluster - A cluster of a line’s text: one glyph or a tab with the ligature parts and combining marks that join it, the bytes of the line’s text that it shows, and its edges on the page.
- Text
Line - A line of a page’s text map: its story and paragraph, its range of the paragraph’s text, its line box and its clusters.
- XmlLimits
- The limits of each XML part, which
Limits::xmlholds. Limits that protect the reader against hostile input. Start fromLimits::defaultand set the limits that differ, so that a new limit breaks no caller.
Enums§
- Address
Error - Why a text does not read as an address. Each error’s text names the fix.
- Address
Step - One step of an address: the story that it starts in, or the place of a block, a row, a cell or a text box among its kind, from 1.
- ArtPictures
Fault - What is wrong with a file of art pictures.
- Configuration
Error - Why a target’s ID names no target, or the configuration or the target’s profile does not
read: the error of
Target::from_strand ofError::Configuration. Why a target’s ID names no target, or the configuration or the target’s profile does not read. An error in a target’s name, a profile or a configuration. - EndHyphen
- A hyphen that a line shows at its end where a word breaks, which the text does not hold.
- Error
- Why a document could not be rendered.
- Fidelity
Level - Overall rendering fidelity of a laid-out document.
- Font
Match Kind - How a font family requested by the document was resolved for rendering.
- Image
Fault - Why an output leaves an image of the display list out.
- Image
Format - The format of an image file.
- Line
Text End - How a line ends.
- Link
Target - Where a hyperlink goes (Link target).
- Omission
Kind - Category of non-font rendering omission or approximation.
- Text
Block Kind - What a text block is.
- Text
Story - A story of the text map (Story): text that reads on by itself, and that a selection stays in. The stories of one page compare in their reading order: the header, the body, the endnotes, the frames, the text boxes, the footnotes and the footer, and the frames and the text boxes each in the order of their layout.
- Warning
- What a rendering left out of the file, or drew in another way than the file asks, while it
went on with the rest. A warning holds no content of the document, only the names that the
file uses to point at a part or a font, cut and with printable characters only (
Name).
Constants§
- ART_
PICTURES_ BYTE_ LIMIT - The most bytes that one call of
ArtPictures::addreads: 32 MiB. - ART_
PICTURES_ CLIP_ DEPTH_ LIMIT - The most clips of an art picture that can hold one shape, one inside another.
- ART_
PICTURES_ COMMAND_ LIMIT - The most commands in the outline of one shape of an art picture: its moves, lines, curves and closes.
- ART_
PICTURES_ REACH_ LIMIT - How far a point of an art picture may lie from its part’s box: four boxes.
- ART_
PICTURES_ SHAPE_ LIMIT - The most items in one part of an art picture: its shapes and the starts and ends of its clips.
- ART_
PICTURES_ SIZE_ LIMIT - The largest size of an art border, in points, of which a picture can be given: the largest
w:szof an art side that the schema’s byte holds.
Traits§
- Random
Access Read - Random-access byte source for opening a
crate::Packagewithout copying the entire ZIP archive into memory (for example, backed by a browserBlob/File.slice()or OPFSFileSystemSyncAccessHandle).
Functions§
- error_
chain - The error chain of
error: its own text, then the text of each cause thatsourcegives, joined by:. Each error of F-Office writes only its own text and gives its cause throughsource, so a place that shows an error to a person writes this, so that the cause stays visible.