get all word of slide through aspose.slide

  • Thread starter akshar108 via DotNetMonster.com
  • Start date
A

akshar108 via DotNetMonster.com

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.License = New Aspose.Slides.
License
lic.SetLicense(HttpContext.Current.Server.MapPath("bin").
ToString + "\\" + "Aspose.Custom.lic")
Dim srcPres As Presentation = New Presentation(root)
Dim totalWords As Int64 = 0



For i As Integer = 1 To srcPres.Slides.LastSlidePosition

Dim srcSld As Slide = srcPres.GetSlideByPosition(i)

Dim thldText1 As String = srcSld.HeaderFooter.
HeaderText.Replace(vbCr, " ").Replace(vbLf, " ").Replace(vbVerticalTab, " ")

Dim splitParams1() As Char = {" "c}

Dim wordsInThisTextHolder1 As Integer = thldText1.
Split(splitParams1, StringSplitOptions.RemoveEmptyEntries).Length

totalWords += wordsInThisTextHolder1


Dim thldText2 As String = srcSld.HeaderFooter.
FooterText.Replace(vbCr, " ").Replace(vbLf, " ").Replace(vbVerticalTab, " ")

Dim splitParams2() As Char = {" "c}

Dim wordsInThisTextHolder2 As Integer = thldText2.
Split(splitParams2, StringSplitOptions.RemoveEmptyEntries).Length

totalWords += wordsInThisTextHolder2


If Not srcSld.Notes Is Nothing Then
Dim thldText3 As String = srcSld.Notes.Text.
Replace(vbCr, " ").Replace(vbLf, " ").Replace(vbVerticalTab, " ")

Dim splitParams3() As Char = {" "c}

Dim wordsInThisTextHolder3 As Integer = thldText2.
Split(splitParams3, StringSplitOptions.RemoveEmptyEntries).Length

totalWords += wordsInThisTextHolder3
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(vbVerticalTab, " ")


Dim splitParams() As Char = {" "c}

Dim wordsInThisTextHolder As Integer =
thldText.Split(splitParams, StringSplitOptions.RemoveEmptyEntries).Length

totalWords += wordsInThisTextHolder

Continue For

End If

End If

If TypeOf shp Is Aspose.Slides.Table Then
Dim dt As Aspose.Slides.Table = shp

For Each tShape As Aspose.Slides.Shape In dt.
Shapes
If tShape.TextFrame IsNot Nothing Then
Dim tfText As String = tShape.
TextFrame.Text.Replace(vbCr, " ").Replace(vbLf, " ").Replace(vbVerticalTab, "
")
Dim splitParams() As Char = {" "c}

Dim wordsInThisTextFrame As Integer =
tfText.Split(splitParams, StringSplitOptions.RemoveEmptyEntries).Length

totalWords += wordsInThisTextFrame
End If
Next
Continue For
End If

If TypeOf shp Is Aspose.Slides.Rectangle Then
Dim rect As Aspose.Slides.Rectangle = shp

If rect.TextFrame IsNot Nothing Then
Dim tfText As String = rect.TextFrame.
Text.Replace(vbCr, " ").Replace(vbLf, " ").Replace(vbVerticalTab, " ")
Dim splitParams() As Char = {" "c}

Dim wordsInThisTextFrame As Integer =
tfText.Split(splitParams, StringSplitOptions.RemoveEmptyEntries).Length

totalWords += wordsInThisTextFrame
End If

Continue For
End If

If TypeOf shp Is Aspose.Slides.GroupShape Then
Try

Dim shp1 As Aspose.Slides.Shape = shp

'NextGr:

Dim dt As Aspose.Slides.GroupShape = shp1

For Each tShape As Aspose.Slides.Shape 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(vbVerticalTab, " ")

Dim splitParams() As Char
= {" "c}

Dim wordsInThisTextFrame
As Integer = tfText.Split(splitParams, StringSplitOptions.RemoveEmptyEntries).
Length

totalWords +=
wordsInThisTextFrame
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.TextFrame Is
Nothing Then
Dim tf As TextFrame =
tShape1.TextFrame

If Not tf.Text Is Nothing
Then

Dim tfText As String
= ""

tfText = tf.Text.
Replace(vbCr, " ").Replace(vbLf, " ").Replace(vbVerticalTab, " ")

Dim splitParams() As
Char = {" "c}

Dim
wordsInThisTextFrame As Integer = tfText.Split(splitParams,
StringSplitOptions.RemoveEmptyEntries).Length

totalWords +=
wordsInThisTextFrame
End If
End If
Next
Else
If Not tShape.TextFrame 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(vbVerticalTab, " ")

Dim splitParams() As Char
= {" "c}

Dim wordsInThisTextFrame
As Integer = tfText.Split(splitParams, StringSplitOptions.RemoveEmptyEntries).
Length

totalWords +=
wordsInThisTextFrame
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.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200710/1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top