Rss & SiteMap

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

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

标题:WordCreator表格内容换行如何写

1楼
飞云 发表于:2025/1/11 16:06:00
如题,请问表格内容从数据库提取后怎么保持换行
2楼
有点蓝 发表于:2025/1/11 17:02:00
举例说明一下
3楼
飞云 发表于:2025/1/12 10:29:00
Dim wdc As New WordCreator()
wdc.PageSize = Word.RtfPageSize.A4
Dim fnt1 As New Font("方正小标宋简体", 20, fontstyle.Bold)
Dim fnt2 As New Font("宋体", 12)

Dim wtb As New Word.Objects.RtfTable(13, 18) '定义一个10行6列的表
wdc.Add(wtb)

For r As Integer = 0 To wtb.Rows.Count - 1 '遍历行
    For c As Integer = 0 To wtb.ColumnCount - 1 '遍历列
        Dim cell As word.Objects.RtfCell = wtb.Rows(r).Cells(c) '定义一个变量引用单元格   
        If r > 1 Then 
            cell.SetRectBorder(Word.RtfBorderStyle.Single, color.Black, 1) '设置默认边框 
        End If
    Next
Next
4楼
飞云 发表于:2025/1/12 10:29:00




With wtb.Rows(0).Cells(0)
    wtb.Rows(0).Height = 50 
    .SetMerged(1, 18)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("个人档案登记表", fnt1))
End With
With wtb.Rows(1).Cells(0)
    .SetMerged(1, 13)
    .Alignment = ContentAlignment.MiddleLeft
    
    .Content.Add(New Word.Objects.RtfString("部门:后勤部", fnt2))
End With
With wtb.Rows(1).Cells(13)
    .SetMerged(1, 5)
    .Alignment = ContentAlignment.MiddleRight
    .Content.Add(New Word.Objects.RtfString("2025-01-01", fnt2))
End With
wtb.Rows(1).Height = 35 
'姓名*******************************************************************************
With wtb.Rows(2).Cells(0)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("姓  名", fnt2))
End With
With wtb.Rows(2).Cells(3)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("张三", fnt2))
End With
'性  别*******************************************************************************
With wtb.Rows(2).Cells(6)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("性  别", fnt2))
End With
With wtb.Rows(2).Cells(9)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("男", fnt2))
End With
'出生年月*******************************************************************************
With wtb.Rows(2).Cells(12)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("出生年月", fnt2))
End With
With wtb.Rows(2).Cells(15)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("2000-01-08", fnt2))
End With

'民 族*******************************************************************************
With wtb.Rows(3).Cells(0)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("民  族", fnt2))
End With
With wtb.Rows(3).Cells(3)
    .SetMerged(1, 3) 
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("汉族", fnt2))
End With
'政治面貌*******************************************************************************
With wtb.Rows(3).Cells(6)
    .SetMerged(1, 3) 
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("政治面貌", fnt2))
End With
With wtb.Rows(3).Cells(9)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("群众", fnt2))
End With
'文化程度*******************************************************************************
With wtb.Rows(3).Cells(12)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("文化程度", fnt2))
End With
With wtb.Rows(3).Cells(15)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("本科", fnt2))
End With


'现任职务*******************************************************************************
With wtb.Rows(4).Cells(0)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("现任职务", fnt2))
End With
With wtb.Rows(4).Cells(3)
    .SetMerged(1, 9)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("科员", fnt2))
End With

'任现职时间*******************************************************************************
With wtb.Rows(4).Cells(12)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("任现职时间", fnt2))
End With
With wtb.Rows(4).Cells(15)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("2024-05-08", fnt2))
End With

'个人履历*******************************************************************************
Dim ll As String = "上学" & vbCrLf & "上班"
With wtb.Rows(5).Cells(0) 
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("个人履历", fnt2))
End With
With wtb.Rows(5).Cells(1)
    .SetMerged(1, 17)
    .Alignment = ContentAlignment.TopLeft
    .Content.Add(New Word.Objects.RtfString(ll, fnt2))
End With


'测评  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * 
With wtb.Rows(7).Cells(0)
    .SetMerged(2, 2)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("测评", fnt2))
End With
With wtb.Rows(7).Cells(2)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("测评人", fnt2))
End With
With wtb.Rows(7).Cells(5)
    ' .SetMerged(1, 7)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("李老师", fnt2))
End With
With wtb.Rows(7).Cells(12)
    .SetMerged(1, 4)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("测评人数", fnt2))
End With
With wtb.Rows(7).Cells(16)
    .SetMerged(1, 2)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("5", fnt2))
End With
5楼
飞云 发表于:2025/1/12 10:30:00
With wtb.Rows(8).Cells(2)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("测评得分", fnt2))
End With
With wtb.Rows(8).Cells(5)
    ' .SetMerged(1, 1)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("100", fnt2))
End With
With wtb.Rows(8).Cells(7)
    .SetMerged(1, 3)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("优秀", fnt2))
End With
With wtb.Rows(8).Cells(10)
    '  .SetMerged(1, 2)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("√", fnt2))
End With

With wtb.Rows(8).Cells(12)
    .SetMerged(1, 4)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("排名", fnt2))
End With
With wtb.Rows(8).Cells(16)
    .SetMerged(1, 2)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString("1", fnt2))
End With
'领导(部长)意见*******************************************************************************
Dim yj As String = "领导" & vbcrlf & "(部长)" & vbcrlf & "意见"
With wtb.Rows(9).Cells(0)
    .SetMerged(1, 2)
    .Alignment = ContentAlignment.MiddleCenter
    .Content.Add(New Word.Objects.RtfString(yj, fnt2))
End With
With wtb.Rows(9).Cells(2)
    .SetMerged(1, 16)
    .Alignment = ContentAlignment.MiddleLeft
    .Content.Add(New Word.Objects.RtfString("同意", fnt2))
End With

'保存并打开文件
Dim fl As String = "c:\temp\" & Format(Date.now, "yyyyMMddHHnnss") & ".docx"
wdc.Save(fl)
Process.Start(fl)
6楼
飞云 发表于:2025/1/12 10:31:00
图片点击可在新窗口打开查看
7楼
飞云 发表于:2025/1/12 10:32:00
图片点击可在新窗口打开查看
8楼
飞云 发表于:2025/1/12 10:33:00
图片点击可在新窗口打开查看
9楼
飞云 发表于:2025/1/12 10:33:00
图片点击可在新窗口打开查看合并后整表就变形了

[此贴子已经被作者于2025/1/12 10:34:26编辑过]
10楼
飞云 发表于:2025/1/12 10:37:00
谢谢老师
1.固定文本标题如何换行
2.读取SQL内容如何换行
3.不规则表合并如何让表不变形
共18 条记录, 每页显示 10 条, 页签: [1] [2]

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

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