Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共3 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:word报表表格中某一字符上标

1楼
benwong2015 发表于:2024/11/28 22:28:00
 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能上标,请问应该如何处理?
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)))

3楼
benwong2015 发表于:2024/11/28 23:16:00
 可以了,非常谢谢
共3 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .05469 s, 2 queries.