以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- word报表表格中某一字符上标 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=194329) |
-- 作者:benwong2015 -- 发布时间:2024/11/28 22:28:00 -- word报表表格中某一字符上标 Dim txt As String = "ABC" Dim tm As String = ProjectPath & "Attachments\\FabricWeight-EN.doc" \'指定模板文件 Dim fl As String = ProjectPath & "Reports\\FabricWeight.Doc" \'指定目标文件 Dim wrt As New WordReport(Tables("FW_Gammage_Report"), tm, fl) \'定义一个WordReport wrt.Build() wrt.Quit Dim app As New MSWord.Application Try Dim fileName = ProjectPath & "Reports\\FabricWeight.Doc" \'指定目标文件 Dim doc As Object = app.Documents.Open(fileName) app.Activedocument.Bookmarks("TestList").Range.Tables(1).Select For Each zr As Row In Tables("FW_Gammage_Report").Rows app.Selection.InsertRowsBelow(1) app.Selection.Font.Bold = 0 app.Selection.MoveRight(Unit:=12) app.Selection.TypeText(Text:=zr("分板号")) app.Selection.MoveRight(Unit:=12) app.Selection.TypeText(Text:=zr("EN客户要求")) app.Selection.MoveRight(Unit:=12) app.Selection.TypeText(Text:=zr("EN测试结果")) app.Selection.MoveRight(Unit:=12) app.Selection.TypeText(Text:=zr("EN结论")) Next app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekMainDocument app.Visible = True Catch ex As exception msgbox(ex.message) app.Quit Finally \'app.Quit End Try 如果表格中 zr(“EN测试结果”)= 0.5cm2,想在生成的报表中cm2中的2能上标,请问应该如何处理?
|
-- 作者:有点蓝 -- 发布时间:2024/11/28 22:37:00 -- https://www.baidu.com/s?wd=vb.net%20word%20%E4%B8%8A%E6%A0%87 试试 app.Selection.TypeText(Text:=zr("EN测试结果").replace("cm2","cm" & ChrW(&H00B2))) |
-- 作者:benwong2015 -- 发布时间:2024/11/28 23:16:00 -- 可以了,非常谢谢 |