Sem descrição

κρμγ f1ff0327a0 Merge pull request #2 from IbraMaN7/master-1 há 1 ano atrás
demo dfbfc8683f made it go getable há 9 anos atrás
demo2 dfbfc8683f made it go getable há 9 anos atrás
demo3 dfbfc8683f made it go getable há 9 anos atrás
generators 3fd544c379 Update gen.go há 1 ano atrás
mappers dfbfc8683f made it go getable há 9 anos atrás
model dfbfc8683f made it go getable há 9 anos atrás
xmlns dfbfc8683f made it go getable há 9 anos atrás
.gitignore 6ac7504650 bugfix fmt, demo updated há 10 anos atrás
2go.png 315e55d049 пщ há 10 anos atrás
LICENSE 2d2c01dbbf initial há 10 anos atrás
README.md a98b04a52b Update README.md há 9 anos atrás
clean.bat 315e55d049 пщ há 10 anos atrás
odf_test.go dfbfc8683f made it go getable há 9 anos atrás

README.md

ODF

Open Document Format (ODF) producer library for Go (golang).

Build Status

Описание

Формирование документа в формате Open Document (ODF) для языка Go (golang).

Формирование документа заключается в последовательном вызове инструкций Форматтера, который выполняет модификацию одной или нескольких частей модели документа. Затем вызывается процедура генерации файла-архива .odf

Клиентский код изолируется от особенностей структуры документа ODF.

Необходимость форматтера обсуловлена тем, что стандарт ODF предполагает изменение видимого содержимого документа посредством изменений в нескольких местах модели документа (стили, встроенные файлы, и т.д.)

Пример

go get github.com/kpmy/odf

В пакете demo есть пример использования ODF для формирования отчета.

Description

This library is for generation of ODF document with Go.

You can produce a document with content by calling the Formatter methods. Then you can save this document to zip-file .odf

No need for your code to handle with ODF XML content. More examples in demo/report.go

Example

package main

import (
    "odf/generators"
    "odf/mappers"
    "odf/model"
    _ "odf/model/stub" //don't forget pimpl
    "odf/xmlns"
    "os"
)

func main() {
    if output, err := os.Create("demo2.odf"); err == nil {
        //we need an empty model
        m := model.ModelFactory()
        //standard formatter
        fm := &mappers.Formatter{}
        //couple them
        fm.ConnectTo(m)
        //we want text
        fm.MimeType = xmlns.MimeText
        //yes we can
        fm.Init()
        //pretty simple
        fm.WriteString("Hello, World!")
        //store file
        generators.GeneratePackage(m, nil, output, fm.MimeType)
        //cleanup
        defer output.Close()
    }
}

Moar

It works in browser now. Got Demo3, GopherJS + Dart.

http://kpmy.github.io/odf/