docparse

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VT_EMPTY           = 0
	VT_NULL            = 1
	VT_I2              = 2
	VT_I4              = 3
	VT_R4              = 4
	VT_R8              = 5
	VT_CY              = 6
	VT_DATE            = 7
	VT_BSTR            = 8
	VT_DISPATCH        = 9
	VT_ERROR           = 10
	VT_BOOL            = 11
	VT_VARIANT         = 12
	VT_UNKNOWN         = 13
	VT_DECIMAL         = 14
	VT_I1              = 16
	VT_UI1             = 17
	VT_UI2             = 18
	VT_UI4             = 19
	VT_I8              = 20
	VT_UI8             = 21
	VT_INT             = 22
	VT_UINT            = 23
	VT_VOID            = 24
	VT_HRESULT         = 25
	VT_PTR             = 26
	VT_SAFEARRAY       = 27
	VT_CARRAY          = 28
	VT_USERDEFINED     = 29
	VT_LPSTR           = 30
	VT_LPWSTR          = 31
	VT_FILETIME        = 64
	VT_BLOB            = 65
	VT_STREAM          = 66
	VT_STORAGE         = 67
	VT_STREAMED_OBJECT = 68
	VT_STORED_OBJECT   = 69
	VT_BLOB_OBJECT     = 70
	VT_CF              = 71
	VT_CLSID           = 72
	VT_VECTOR          = 0x1000

	PAGECODE_UTF16LE = 1200
	PAGECODE_UTF16BE = 1201
	PAGECODE_UTF8    = 65001
	PAGECODE_GB2312  = 956
	PAGECODE_BIG5    = 950
)
View Source
const (
	EMPTY       = iota
	USERSTORAGE = iota
	USERSTREAM  = iota
	LOCKBYTES   = iota
	PROPERTY    = iota
	ROOT        = iota
)

Variables

View Source
var (
	VT = map[uint32]string{
		0:      "VT_EMPTY",
		1:      "VT_NULL",
		2:      "VT_I2",
		3:      "VT_I4",
		4:      "VT_R4",
		5:      "VT_R8",
		6:      "VT_CY",
		7:      "VT_DATE",
		8:      "VT_BSTR",
		9:      "VT_DISPATCH",
		10:     "VT_ERROR",
		11:     "VT_BOOL",
		12:     "VT_VARIANT",
		13:     "VT_UNKNOWN",
		14:     "VT_DECIMAL",
		16:     "VT_I1",
		17:     "VT_UI1",
		18:     "VT_UI2",
		19:     "VT_UI4",
		20:     "VT_I8",
		21:     "VT_UI8",
		22:     "VT_INT",
		23:     "VT_UINT",
		24:     "VT_VOID",
		25:     "VT_HRESULT",
		26:     "VT_PTR",
		27:     "VT_SAFEARRAY",
		28:     "VT_CARRAY",
		29:     "VT_USERDEFINED",
		30:     "VT_LPSTR",
		31:     "VT_LPWSTR",
		64:     "VT_FILETIME",
		65:     "VT_BLOB",
		66:     "VT_STREAM",
		67:     "VT_STORAGE",
		68:     "VT_STREAMED_OBJECT",
		69:     "VT_STORED_OBJECT",
		70:     "VT_BLOB_OBJECT",
		71:     "VT_CF",
		72:     "VT_CLSID",
		0x1000: "VT_VECTOR",
	}

	SUMMARY_ATTRIBS = []string{"codepage", "title", "subject", "author", "keywords", "comments",
		"template", "last_saved_by", "revision_number", "total_edit_time",
		"last_printed", "create_time", "last_saved_time", "num_pages",
		"num_words", "num_chars", "thumbnail", "creating_application",
		"security",
	}

	DOCSUM_ATTRIBS = []string{"codepage_doc", "category", "presentation_target", "bytes", "lines", "paragraphs",
		"slides", "notes", "hidden_slides", "mm_clips",
		"scale_crop", "heading_pairs", "titles_of_parts", "manager",
		"company", "links_dirty", "chars_with_spaces", "unused", "shared_doc",
		"link_base", "hlinks", "hlinks_changed", "version", "dig_sig",
		"content_type", "content_status", "language", "doc_version",
	}
)
View Source
var DEBUG = false
View Source
var ENDOFCHAIN = uint32(0xFFFFFFFE) //-2
View Source
var FREESECT = uint32(0xFFFFFFFF) // -1

Functions

func GetPlainText

func GetPlainText(reader io.ReadSeeker, code uint16) (paragraphs []string)

func I8

func I8(b byte) uint8

func I16

func I16(b []byte) uint16

func I32

func I32(b []byte) uint32

func ParseAsPropertyBasic

func ParseAsPropertyBasic(rawBuf []byte, offset int, ptype uint32) (e any, size int)

func ParseInfomartion

func ParseInfomartion(name string, reader_info io.ReadSeeker) (data map[uint32]any)

func ReadDoc

func ReadDoc(file string) []string

func UTF16Decode

func UTF16Decode(data []byte) string

Types

type File

type File struct {
	NameBts   [32]uint16
	Bsize     uint16
	Type      byte
	Flag      byte
	Left      uint32
	Right     uint32
	Child     uint32
	Guid      [8]uint16
	Userflags uint32
	Time      [2]uint64
	Sstart    uint32
	Size      uint32
	Proptype  uint32
}

func (*File) Name

func (d *File) Name() string
type Header struct {
	Id        [2]uint32
	Clid      [4]uint32
	Verminor  uint16
	Verdll    uint16
	Byteorder uint16
	Lsectorb  uint16
	Lssectorb uint16

	Cfat     uint32 //Total number of sectors used for the sector allocation table
	Dirstart uint32 //SecID of first sector of the directory stream

	Sectorcutoff uint32 //Minimum size of a standard stream
	Sfatstart    uint32 //SecID of first sector of the short-sector allocation table
	Csfat        uint32 //Total number of sectors used for the short-sector allocation table
	Difstart     uint32 //SecID of first sector of the master sector allocation table
	Cdif         uint32 //Total number of sectors used for the master sector allocation table
	Msat         [109]uint32
	// contains filtered or unexported fields
}

type Ole

type Ole struct {
	Lsector  uint32
	Lssector uint32
	SecID    []uint32
	SSecID   []uint32
	Files    []File
	// contains filtered or unexported fields
}

func Open

func Open(reader io.ReadSeeker, charset string) (ole *Ole, err error)

func (*Ole) ListDir

func (o *Ole) ListDir() (dir []*File, err error)

func (*Ole) OpenFile

func (o *Ole) OpenFile(file *File, root *File) io.ReadSeeker

type PSS

type PSS struct {
	// contains filtered or unexported fields
}

type Sector

type Sector []byte

func (*Sector) AllValues

func (s *Sector) AllValues(size uint32) []uint32

func (*Sector) MsatValues

func (s *Sector) MsatValues(size uint32) []uint32

func (*Sector) NextSid

func (s *Sector) NextSid(size uint32) uint32

func (*Sector) Uint32

func (s *Sector) Uint32(bit uint32) uint32

type Stream

type Stream struct {
	Ole     *Ole
	Start   uint32
	Pos     uint32
	Cfat    int
	Size    int
	Fatpos  uint32
	Bufsize uint32
	Eof     byte
	Sfat    bool
}

type StreamReader

type StreamReader struct {
	// contains filtered or unexported fields
}

func (*StreamReader) Read

func (r *StreamReader) Read(p []byte) (n int, err error)

func (*StreamReader) Seek

func (r *StreamReader) Seek(offset int64, whence int) (offset_result int64, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL