Rss & SiteMap

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

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

标题:关于word报表模板分组显示问题

91楼
jhxb8821 发表于:2024/6/8 13:56:00
Dim r As Row = tables("表C").current
Dim 身份证号码 As String = r("身份证号码")
Dim 编号 As String = r("人员编号")
msgbox(身份证号码 & "," & 编号)
For Each File As String In FileSys.GetFiles(ProjectPath & "\Attachments\照片文件夹\") 
    msgbox(File)
    Dim name As String = FileSys.GetName(file).split(".")(0) 
    msgbox(name)
    If name.contains(身份证号码) Then
        msgbox("开始替换:" & name.replace(身份证号码, 编号))
        FileSys.RenameFile(file, name.replace(身份证号码, 编号)) 
        msgbox("OK")
    End If
Next
老师, 经测试
第1个对话框:msgbox(身份证号码 & "," & 编号) , 有显示对话框, 但无内容, 是空白的
第2个对话框:msgbox(File), 显示正常
第3个对话框:msgbox(name), 显示正常
第4个对话框:msgbox("开始替换:" & name.replace(身份证号码, 编号)), 显示错误
详细错误信息:String cannot be Of zero length.Parameter name: oldValue
92楼
jhxb8821 发表于:2024/6/8 14:26:00
For Each r As Row In Tables("表C").Rows
    Dim 身份证号码 As String = r("身份证号码")
    Dim 编号 As String = r("人员编号")
    msgbox(身份证号码 & "," & 编号)
    For Each File As String In FileSys.GetFiles(ProjectPath & "\Attachments\照片文件夹\") 
        msgbox(File)
        Dim name1 As String = FileSys.GetName(file).split(".")(0)
        Dim name2 As String = "." & FileSys.GetName(file).split(".")(1) 
        If 编号 Is Nothing Then '排除空白行
            ' If name1.contains(身份证号码) Then ’这一代码到底要不要?
            Dim file1 As String = name1.replace(身份证号码, 编号) & name2 '加上后缀
            msgbox(file1)
            FileSys.RenameFile(file, file1) '目前实际上未重命名?
            msgbox("OK")
        End If
    Next 
Next


'老师, 这里加上后缀后怎么修改?
[此贴子已经被作者于2024/6/8 14:38:25编辑过]
93楼
有点蓝 发表于:2024/6/8 14:41:00
For Each r As dataRow In dataTables("表C").select("人员编号 is not null")
    Dim 身份证号码 As String = r("身份证号码")
    Dim 编号 As String = r("人员编号")
    msgbox(身份证号码 & "," & 编号)
    For Each File As String In FileSys.GetFiles(ProjectPath & "\Attachments\照片文件夹\") 
        msgbox(File)
        Dim name1 As String = FileSys.GetName(file)
        msgbox(name1)
        If name1.contains(身份证号码) Then
            FileSys.RenameFile(file, name1.replace(身份证号码, 编号))
        end if
    Next 
Next
94楼
jhxb8821 发表于:2024/6/8 17:05:00
详细错误信息:Object reference not set to an instance of an object.
老师,出现错误信息
95楼
有点蓝 发表于:2024/6/10 21:00:00
说过N遍了要学会调试,自行调试看哪一句代码出错
96楼
jhxb8821 发表于:2024/6/11 10:22:00
此代码,以身份证号码命名,现文件名全部替换成"人员编号",代码完美
For Each r As Row In Tables("提取文件名").Rows 
    Dim 身份证号码 As String = r("身份证号码")
    Dim 编号 As String = r("人员编号")
    msgbox(身份证号码 & "," & 编号)
    For Each File As String In FileSys.GetFiles(ProjectPath & "\Attachments\照片文件夹2406\") 
        Dim name1 As String = FileSys.GetName(file).split(".")(0) '只生成文件名(不含路径,也不带文件后缀)
        Dim name2 As String = "." & FileSys.GetName(file).split(".")(1) '只生成文件后缀
        msgbox("文件名:" & name1 & ",  后缀:" & name2)
        If name1.contains(身份证号码) Then 
            Dim file1 As String = name1.replace(身份证号码, 编号) & name2 '加上后缀 ,开始替换     
            msgbox("开始替换:" & file1)
            FileSys.RenameFile(file, file1) '文件重命名
            msgbox("OK")
        End If
    Next
Next

'示例四
'如果表中有多个图片型或文件型列,那么应该在BeforeAttachFile判断列名,例如要求照片列只能插入JPG文件,而且存放在名为"照片"的子目录中,简历列只能插入Word文件,而且存放在名为"简历"的子目录中:
Dim ext As String
ext = e.FileName.SubString(e.FileName.LastIndexof(".") + 1) '获得文件后缀名
Select Case e.DataCol.Name
    Case "照片"
        If ext = "jpg" Then
            e.SubFolder = ext
        Else
            MessageBox.Show("此列只能插入jpg文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
            e.Cancel = True
        End If
    Case "简历"
        If ext = "doc" Then
            e.SubFolder = ext
        Else
            MessageBox.Show("此列只能插入Word文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
            e.Cancel = True
        End If
End Select
老师, 这是帮助中的示例四代码, 上述代码"照片"和"简历"文件夹, 自动放在Attachments文件夹中, 我想把"照片"和"简历"文件夹放在指定文件夹之中, 比如:ProjectPath & "\Attachments\我的文档2406\"
请问老师, 这里怎么指定存储路径
97楼
有点蓝 发表于:2024/6/11 10:24:00
e.SubFolder = "我的文档2406"
98楼
jhxb8821 发表于:2024/6/11 11:10:00
谢谢老师
99楼
jhxb8821 发表于:2024/6/11 18:12:00
老师,字符间距CharSpacing,  字符缩放函数是什么,也就是字体拉伸函数
[此贴子已经被作者于2024/6/11 19:28:13编辑过]
100楼
有点蓝 发表于:2024/6/11 21:08:00
没有这种函数。只有这些:http://www.foxtable.com/webhelp/topics/1179.htm
共116 条记录, 每页显示 10 条, 页签: [1]... [6][7][8][9] [10] [11][12]

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

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