Hi,
I have aspose slide component and i want to take all string in the
presentation's all slide but that component not give any method to get that
direct we have to take all shape's textframe and then take text i do that
things and then count words but i not get true word count can any one say me
the technique to get that or give me any code for that my code is following
Try
Dim lic As Aspose.Slides.L icense = New Aspose.Slides.
License
lic.SetLicense( HttpContext.Cur rent.Server.Map Path("bin").
ToString + "\\" + "Aspose.Custom. lic")
Dim srcPres As Presentation = New Presentation(ro ot)
Dim totalWords As Int64 = 0
For i As Integer = 1 To srcPres.Slides. LastSlidePositi on
Dim srcSld As Slide = srcPres.GetSlid eByPosition(i)
Dim thldText1 As String = srcSld.HeaderFo oter.
HeaderText.Repl ace(vbCr, " ").Replace(vbLf , " ").Replace(vbVe rticalTab, " ")
Dim splitParams1() As Char = {" "c}
Dim wordsInThisText Holder1 As Integer = thldText1.
Split(splitPara ms1, StringSplitOpti ons.RemoveEmpty Entries).Length
totalWords += wordsInThisText Holder1
Dim thldText2 As String = srcSld.HeaderFo oter.
FooterText.Repl ace(vbCr, " ").Replace(vbLf , " ").Replace(vbVe rticalTab, " ")
Dim splitParams2() As Char = {" "c}
Dim wordsInThisText Holder2 As Integer = thldText2.
Split(splitPara ms2, StringSplitOpti ons.RemoveEmpty Entries).Length
totalWords += wordsInThisText Holder2
If Not srcSld.Notes Is Nothing Then
Dim thldText3 As String = srcSld.Notes.Te xt.
Replace(vbCr, " ").Replace(vbLf , " ").Replace(vbVe rticalTab, " ")
Dim splitParams3() As Char = {" "c}
Dim wordsInThisText Holder3 As Integer = thldText2.
Split(splitPara ms3, StringSplitOpti ons.RemoveEmpty Entries).Length
totalWords += wordsInThisText Holder3
End If
For Each shp As Shape In srcSld.Shapes
If Not shp.Placeholder Is Nothing Then
If TypeOf shp.Placeholder Is TextHolder Then
Dim thld As TextHolder = shp.Placeholder
Dim thldText As String = thld.Text.
Replace(vbCr, " ").Replace(vbLf , " ").Replace(vbVe rticalTab, " ")
Dim splitParams() As Char = {" "c}
Dim wordsInThisText Holder As Integer =
thldText.Split( splitParams, StringSplitOpti ons.RemoveEmpty Entries).Length
totalWords += wordsInThisText Holder
Continue For
End If
End If
If TypeOf shp Is Aspose.Slides.T able Then
Dim dt As Aspose.Slides.T able = shp
For Each tShape As Aspose.Slides.S hape In dt.
Shapes
If tShape.TextFram e IsNot Nothing Then
Dim tfText As String = tShape.
TextFrame.Text. Replace(vbCr, " ").Replace(vbLf , " ").Replace(vbVe rticalTab, "
")
Dim splitParams() As Char = {" "c}
Dim wordsInThisText Frame As Integer =
tfText.Split(sp litParams, StringSplitOpti ons.RemoveEmpty Entries).Length
totalWords += wordsInThisText Frame
End If
Next
Continue For
End If
If TypeOf shp Is Aspose.Slides.R ectangle Then
Dim rect As Aspose.Slides.R ectangle = shp
If rect.TextFrame IsNot Nothing Then
Dim tfText As String = rect.TextFrame.
Text.Replace(vb Cr, " ").Replace(vbLf , " ").Replace(vbVe rticalTab, " ")
Dim splitParams() As Char = {" "c}
Dim wordsInThisText Frame As Integer =
tfText.Split(sp litParams, StringSplitOpti ons.RemoveEmpty Entries).Length
totalWords += wordsInThisText Frame
End If
Continue For
End If
If TypeOf shp Is Aspose.Slides.G roupShape Then
Try
Dim shp1 As Aspose.Slides.S hape = shp
'NextGr:
Dim dt As Aspose.Slides.G roupShape = shp1
For Each tShape As Aspose.Slides.S hape In
dt.Shapes
If TypeOf tShape Is Aspose.Slides.
Rectangle Then
Dim trect As Aspose.Slides.
Rectangle = tShape
If Not trect.TextFrame Is Nothing
Then
Dim tf As TextFrame = trect.
TextFrame
If Not tf.Text Is Nothing
Then
Dim tfText As String = ""
tfText = tf.Text.Replace
(vbCr, " ").Replace(vbLf , " ").Replace(vbVe rticalTab, " ")
Dim splitParams() As Char
= {" "c}
Dim wordsInThisText Frame
As Integer = tfText.Split(sp litParams, StringSplitOpti ons.RemoveEmpty Entries).
Length
totalWords +=
wordsInThisText Frame
End If
End If
End If
If TypeOf tShape Is Aspose.Slides.
GroupShape Then
'totalWords += Group(tShape,
totalWords)
' shp1 = tShape
' GoTo NextGr
For Each tShape1 As Aspose.Slides.
Shape In dt.Shapes
If Not tShape1.TextFra me Is
Nothing Then
Dim tf As TextFrame =
tShape1.TextFra me
If Not tf.Text Is Nothing
Then
Dim tfText As String
= ""
tfText = tf.Text.
Replace(vbCr, " ").Replace(vbLf , " ").Replace(vbVe rticalTab, " ")
Dim splitParams() As
Char = {" "c}
Dim
wordsInThisText Frame As Integer = tfText.Split(sp litParams,
StringSplitOpti ons.RemoveEmpty Entries).Length
totalWords +=
wordsInThisText Frame
End If
End If
Next
Else
If Not tShape.TextFram e Is
Nothing Then
Dim tf As TextFrame = tShape.
TextFrame
If Not tf.Text Is Nothing
Then
Dim tfText As String = ""
tfText = tf.Text.Replace
(vbCr, " ").Replace(vbLf , " ").Replace(vbVe rticalTab, " ")
Dim splitParams() As Char
= {" "c}
Dim wordsInThisText Frame
As Integer = tfText.Split(sp litParams, StringSplitOpti ons.RemoveEmpty Entries).
Length
totalWords +=
wordsInThisText Frame
End If
End If
End If
Next
Continue For
Catch ex As Exception
End Try
--
Ashish Langhnoja
..Net Developer (IntelSoft Soutions Pvt. Ltd.)
Gujarat(India)
Message posted via DotNetMonster.c om
http://www.dotnetmonster.com/Uwe/For...p-net/200710/1