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
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