1 Star 0 Fork 1

青大叔/gooxml

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 1001 Bytes
一键复制 编辑 原始数据 按行查看 历史
qwj 提交于 2021-09-03 14:09 +08:00 . 修改包名
// Copyright 2017 Baliance. All rights reserved.
package main
import (
"log"
"gitee.com/jiewen/gooxml/document"
"gitee.com/jiewen/gooxml/measurement"
"gitee.com/jiewen/gooxml/schema/soo/wml"
)
func main() {
doc := document.New()
lorem := `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin lobortis, lectus dictum feugiat tempus, sem neque finibus enim, sed eleifend sem nunc ac diam. Vestibulum tempus sagittis elementum.`
// single spaced
para := doc.AddParagraph()
run := para.AddRun()
run.AddText(lorem)
run.AddText(lorem)
run.AddBreak()
// double spaced is twice the text height (24 points in this case as the text height is 12 points)
para = doc.AddParagraph()
para.Properties().Spacing().SetLineSpacing(24*measurement.Point, wml.ST_LineSpacingRuleAuto)
run = para.AddRun()
run.AddText(lorem)
run.AddText(lorem)
run.AddBreak()
if err := doc.Validate(); err != nil {
log.Fatalf("error during validation: %s", err)
}
doc.SaveToFile("line-spacing.docx")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jiewen/gooxml.git
git@gitee.com:jiewen/gooxml.git
jiewen
gooxml
gooxml
c517a803bade

搜索帮助