• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

gisoracle

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

word 中Sentences、Paragraph等含义和用法

word 中Sentences、Paragraph等含义和用法
word 中有Words,Characters,Sentences、Paragraph,Sections 具体含义如下
表达式             含义   返回的对象
Words(index)           单词      Range
Characters(index)    字符      Range
Sentences(index)     句子      Range
Paragraphs(index)   段落      Paragraph
Sections(index)        节          Section
一般情况,一个文档是有几个节(Sections)组成,一节有几段(Paragraphs),
每段有几句(Sentences)组成,每句又有几个单词Words组成,每个单词有几个字符组成
如下文档,有两节,三段,大概如下,具体见附件
Excelhome是一个不错的网站,你不只是Execl的家,也是word,ppt的家,我们都喜欢你。希望你越办越好。
gisOracle是一个不错的人,他做不少关于word,ppt的软件。如word转图片pdf,word编号工具,word转图片word;ppt转换图片pdf,ppt转换图片ppt,我希望他的软件。
--有分节符
Microsoft 的Office做的很好,相信他会做的更好。
vba如下
Private Sub CommandButton1_Click()
        MsgBox "当前文档有" & ActiveDocument.Sections.Count & "节"
        Dim i, j As Integer
        i = 1
        Dim oSection As Section

        For Each oSection In ActiveDocument.Sections
                MsgBox "当前文档第" & i & "节,的内容:" & oSection.Range.Text     
                i = i + 1             
        Next

        MsgBox "当前文档有" & ActiveDocument.Paragraphs.Count & "段"

        i = 1
        Dim oParagraph As Paragraph
        Dim oSentence As Range
       
        For Each oParagraph In ActiveDocument.Paragraphs
       
    MsgBox "当前文档第" & i & "段,的内容:" & oParagraph.Range.Text
    j = 1
        
    For Each oSentence In oParagraph.Range.Sentences
            MsgBox "当前文档第" & i & "段,的内容,第" & j & "句的内容:" & oSentence.Text
            j = j + 1     
    Next   
   
    i = i + 1
             
        Next
        i = 1
       
        Dim oword As Range
       
        For Each oword In ActiveDocument.Words
          MsgBox "当前文档第" & i & "单词,的内容:" & oword.Text
    If i = 1 Then
           
       For j = 1 To oword.Characters.Count
        MsgBox "当前文档第" & i & "单词的第:" & j & "字符为:" & oword.Characters.Item(j).Text              
       Next
      
    End If
   
         i = i + 1
                  
        Next


End Sub

posted on 2009-09-12 08:58  gisai  阅读(2469)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3