Skip to content

pure go immplement to read plaintext doc. no sharelib ! no sharelib ! no sharelib !

License

Notifications You must be signed in to change notification settings

Qingluan/doc-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DESC

a pure go to read doc(97 ) / docx (2007)

feature

  • read text in docx
  • read text in doc
  • read table within docx
  • read table within doc
  • markdown to docx
  • read image within docx
  • read image within doc

TODO

  • read docx with table and image and link

USAGE

package main

import (
	"fmt"
	"os"
	"strings"

	"github.com/Qingluan/doc-go/docparse"
	"github.com/Qingluan/doc-go/docxgen"
	"github.com/Qingluan/doc-go/docxparse"
)

func main() {
	f := os.Args[1]
	if strings.HasSuffix(f, ".docx") {
		res := docxparse.ReadDocx(f)
		for _, p := range res {
			fmt.Println(p)
		}

	} else if strings.HasSuffix(f, ".doc") {
		//doc
		res := docparse.ReadDoc(f)
		for _, p := range res {
			fmt.Println(p)
		}
	} else if strings.HasSuffix(f, ".md") {
		create := docxgen.NewDocCreator()
		content, _ := os.ReadFile(f)
		create.FromMarkdown(string(content)).ExportDocx("out.docx")
		fmt.Println("docx文件已生成:", "out.docx")
	}

}

About

pure go immplement to read plaintext doc. no sharelib ! no sharelib ! no sharelib !

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages