metagoffice

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

README

Package to extract metadata of Office files

Travis build Go Report Card

This package is intended to be a powerful alternative to other solutions for extract metadata from Office files.

The main features of metagoffice are:

  • Read metadata of xlsx files.
  • Read metadata of docx files.
  • Read metadata of pptx files.

How to use ?


package main

import (
	"fmt"

	"github.com/kevinborras/metagoffice"
)

func main() {
	
	file, err := os.Open("document.docx")
	if err != nil {
		log.Fatal(err)
	}
	file.Close()
	content, err := metagoffice.GetContent(file)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("Title: ", content.Title)
	fmt.Println("Subject: ", content.Subject)
	fmt.Println("Creator: ", content.Creator)
	fmt.Println("Keywords: ", content.Keywords)
	fmt.Println("Description: ", content.Description)
	fmt.Println("Last modified by: ", content.LastModifiedBy)
	fmt.Println("Revision: ", content.Revision)
	fmt.Println("Created: ", content.Created)
	fmt.Println("Modified: ", content.Modified)
	fmt.Println("Category: ", content.Category)

}

Output

Title:  Test Document
Subject:
Creator:  Soler, Kevin
Keywords:  This is a tag
Description:  This is a comment
Last modified by:  Soler, Kevin
Revision:  4
Created:  2018-10-12T14:01:00Z
Modified:  2018-10-15T11:23:00Z
Category:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type XMLContent

type XMLContent struct {
	Title          string `xml:"title"`
	Subject        string `xml:"subject"`
	Creator        string `xml:"creator"`
	Keywords       string `xml:"keywords"`
	Description    string `xml:"description"`
	LastModifiedBy string `xml:"lastModifiedBy"`
	Revision       string `xml:"revision"`
	Created        string `xml:"created"`
	Modified       string `xml:"modified"`
	Category       string `xml:"category"`
}

XMLContent contains the fields of te file core.xml

func GetContent

func GetContent(document *os.File) (fields XMLContent, err error)

GetContent function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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