-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请问可以写这样总页数的脚注吗? #5
Comments
可以, 参考使用example当中 ComplexReportFooterExecutor() 的写法 |
用 {#TotalPage#} 脚注页面 RightAlign() 好像不是右对齐了, 右边有空出来一块, |
你怎样使用的RightAlign(), 有简单的案例吗? |
@tiechui1994 多谢支持, 下面是对 master分支 example 中的 complex_report_test.go 中 133行的 ComplexReportFooterExecutor 函数进行修订操作, func ComplexReportFooterExecutor(report *core.Report) {
content := fmt.Sprintf("第 %v / {#TotalPage#} 页", report.GetCurrentPageNo())
footer := gopdf.NewSpan(10, 0, report)
footer.SetFont(textFont)
footer.SetFontColor("79,79,79")
footer.SetBorder(core.Scope{Top: 0})
//footer.HorizontalCentered().SetContent(content).GenerateAtomicCell()
footer.RightAlign().SetContent(content).GenerateAtomicCell()
} 上述代码仅将最后的格式修订为向右对齐, 最后生成的pdf脚注向右对齐 是有一定的空白的, 下面是添加我自己的代码, func ComplexReportFooterExecutor(report *core.Report) {
content := fmt.Sprintf("第 %v / {#TotalPage#} 页", report.GetCurrentPageNo())
footer := gopdf.NewSpan(10, 0, report)
footer.SetFont(textFont)
footer.SetFontColor("79,79,79")
footer.SetBorder(core.Scope{Top: 0})
//footer.HorizontalCentered().SetContent(content).GenerateAtomicCell()
footer.RightAlign().SetContent(content).GenerateAtomicCell()
footer = gopdf.NewSpan(5, 0, report)
footer.SetFont(textFont)
footer.SetBorder(core.Scope{Top: -10})
footer.SetFontColor("79,79,79")
footer.RightAlign().SetContent(fmt.Sprintf("The inspection report is generated at %v", time.Now().Format(DateFormat))).GenerateAtomicCell()
} 上面这个代码可以看出来 脚注的两行明显不向右对齐, 下面是我想要的效果, func ComplexReportFooterExecutor(report *core.Report) {
//content := fmt.Sprintf("第 %v / {#TotalPage#} 页", report.GetCurrentPageNo())
content := fmt.Sprintf("第 %v / %v 页", report.GetCurrentPageNo(), 3)
footer := gopdf.NewSpan(10, 0, report)
footer.SetFont(textFont)
footer.SetFontColor("79,79,79")
footer.SetBorder(core.Scope{Top: 0})
//footer.HorizontalCentered().SetContent(content).GenerateAtomicCell()
footer.RightAlign().SetContent(content).GenerateAtomicCell()
footer = gopdf.NewSpan(5, 0, report)
footer.SetFont(textFont)
footer.SetBorder(core.Scope{Bottom: 10})
footer.SetFontColor("79,79,79")
footer.RightAlign().SetContent(fmt.Sprintf("The inspection report is generated at %v", time.Now().Format(DateFormat))).GenerateAtomicCell()
} 上面这个代码 没有使用 {#TotalPage#}占位符, 所以 最后这一行记录的坐标是不一样的,这样就能使得两行脚注很对齐了 我看了一下你的代码, 没太看明白 不知道咋修改, 帮忙看一下, 谢谢呢, |
比如在每页页脚 写下如下脚注
第 1/10 页
目前发现 好像只能获得第几页的脚注, 却不能一下获得总页码
The text was updated successfully, but these errors were encountered: