Documentation
¶
Overview ¶
Package odf opens OpenDocument files, such as the documents of LibreOffice Writer, Calc, Impress and Draw.
A document gives the thumbnail that every OpenDocument file holds, in Thumbnails/thumbnail.png (D11), and the pages of the texts, the spreadsheets, the presentations and the drawings (D24):
- A text, of Writer, goes through the layout of the ebooks, with its styles, its lists, the numbers of its headings, its tables, its pictures, its shapes and its charts.
- A spreadsheet, of Calc, puts each sheet on pages, in order, as printing does, with its pictures and its charts.
- A presentation, of Impress, or a drawing, of Draw, gives one page for each page of the file, with its shapes, its pictures, its text and its charts.
internal/chart draws the charts of the embedded objects (D27), and odf/internal/drawpage draws the shapes of a text. The other kinds of files, such as a chart or a formula on its own, give no pages, and Page returns an error that wraps ivy.ErrUnsupported. Describe reads the title, the author and the dates of meta.xml.
A file that a password protects opens with the password of ivy.Config, or with the function PasswordFunc of ivy.Config (D12). The package reads Blowfish, the cipher of OpenOffice, AES with PBKDF2, the cipher of ODF 1.2 and 1.3, and AES-GCM with Argon2id, which LibreOffice writes by default for ODF 1.4 (D25).
Index ¶
- Variables
- type Document
- func (d *Document) Close() error
- func (d *Document) Describe(ctx context.Context) (info ivy.Info, err error)
- func (d *Document) Mime() string
- func (d *Document) Page(ctx context.Context, n int) (ivy.Page, error)
- func (d *Document) PageCount(ctx context.Context) (int, error)
- func (d *Document) Previews(ctx context.Context) iter.Seq2[ivy.Preview, error]
- type Option
Constants ¶
This section is empty.
Variables ¶
var Format = ivy.Format{ Name: "odf", Mimes: []string{ "application/vnd.oasis.opendocument.text", "application/vnd.oasis.opendocument.text-template", "application/vnd.oasis.opendocument.text-master", "application/vnd.oasis.opendocument.spreadsheet", "application/vnd.oasis.opendocument.spreadsheet-template", "application/vnd.oasis.opendocument.presentation", "application/vnd.oasis.opendocument.presentation-template", "application/vnd.oasis.opendocument.graphics", "application/vnd.oasis.opendocument.graphics-template", "application/vnd.oasis.opendocument.chart", "application/vnd.oasis.opendocument.formula", }, Exts: []string{"odt", "ott", "odm", "ods", "ots", "odp", "otp", "odg", "otg", "odc", "odf"}, Open: func(ctx context.Context, src ivy.Source, cfg ivy.Config) (ivy.Document, error) { return Open(ctx, src, WithConfig(cfg)) }, }
Format describes the package for the registry of a program.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document is an open OpenDocument file.
func Open ¶
Open opens an OpenDocument file. It returns an error that wraps ivy.ErrFormat if src is not an OpenDocument file, and one that wraps ivy.ErrPassword if the file is encrypted and the configuration does not give the right password.
func (*Document) Describe ¶
Describe satisfies the ivy.Describer interface. It reads the metadata of the file, in meta.xml: the title, the subject, the language, the dates, the program that made the file, and the author. The author is meta:initial-creator, who made the file, or else dc:creator, who changed it last. A file without meta.xml says nothing. The metadata is a help, so an entry that is damaged says nothing too, and the fault is logged.
func (*Document) Mime ¶
Mime returns the mime type that the file declares, such as "application/vnd.oasis.opendocument.text". It is empty if the file does not declare one.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
drawpage
Package drawpage puts the pages of the presentations and the drawings of OpenDocument on pages: Impress and Draw, odp, otp, odg and otg.
|
Package drawpage puts the pages of the presentations and the drawings of OpenDocument on pages: Impress and Draw, odp, otp, odg and otg. |
|
odfcrypt
Package odfcrypt reads the manifest of an OpenDocument file, and decrypts the entries that a password protects, as part 3 of ODF 1.2 describes in section 3.4 and as OpenOffice wrote them before ODF 1.2:
|
Package odfcrypt reads the manifest of an OpenDocument file, and decrypts the entries that a password protects, as part 3 of ODF 1.2 describes in section 3.4 and as OpenOffice wrote them before ODF 1.2: |