default_test.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package test
  2. import (
  3. "fmt"
  4. "testing"
  5. "time"
  6. )
  7. func TestBeego(t *testing.T) {
  8. formatTimeStr := "2022-05-25 18:58"
  9. formatTime,err:=time.Parse("2006-01-02 15:04",formatTimeStr)
  10. if err!=nil{
  11. fmt.Println(err)
  12. }
  13. fmt.Println(formatTime) //打印结果:2017-04-11 13:33:37 +0000 UTC
  14. //// Read from docx file
  15. //r, err := docx.ReadDocxFile("./template.docx")
  16. //// Or read from memory
  17. //// r, err := docx.ReadDocxFromMemory(data io.ReaderAt, size int64)
  18. //
  19. //// Or read from a filesystem object:
  20. //// r, err := docx.ReadDocxFromFS(file string, fs fs.FS)
  21. //
  22. //if err != nil {
  23. // panic(err)
  24. //}
  25. //docx1 := r.Editable()
  26. //// Replace like https://golang.org/pkg/strings/#Replace
  27. //docx1.Replace("old_1_1", "new_1_1", -1)
  28. //docx1.Replace("old_1_2", "new_1_2", -1)
  29. ////docx1.ReplaceLink("http://example.com/", "https://github.com/nguyenthenguyen/docx", 1)
  30. ////docx1.ReplaceHeader("out with the old", "in with the new")
  31. ////docx1.ReplaceFooter("Change This Footer", "new footer")
  32. //docx1.WriteToFile("./new_result_1.docx")
  33. //
  34. //docx2 := r.Editable()
  35. //docx2.Replace("old_2_1", "new_2_1", -1)
  36. //docx2.Replace("old_2_2", "new_2_2", -1)
  37. //docx2.WriteToFile("./new_result_2.docx")
  38. //// Or write to ioWriter
  39. //// docx2.Write(ioWriter io.Writer)
  40. //docx3 := r.Editable()
  41. ////Currently only swaps apples for apples i.e. png to png, and not png to jpeg etc.
  42. ////d.ReplaceImage("word/media/image1.png", "./new.png")
  43. //docx3.WriteToFile("./new_result_3.docx")
  44. }