hi,
I want to get buitin property of the powerpoint file from aspose slide component can any one say how can i get that like lines, words charater etc.
I am afraid; I could not understand your requirement. Please clarify.
FYI : you can read the custom document properties of ppt file through Aspose.Slides using Presntation.CustomDocumentProperties property.
hi,
i want to tell that i want to get word count of preseantion which is in the property of the preseantion.
you can get it in ms powerpoint File manu -> propertie -> statics i wnat to get that
and if you have msn then i tell you online
No, there is no direct way to get these statistics probably PowerPoint does not store them and calculates them at runtime, however you can use Aspose.Slides to calculate these statistics.
so can u tell me the way how can i get that things
i m using following way to get string and then word count from the file but not get true word count
so please say me how i get word count of presentation i m attaching file with this for word count which has 321 words.
Dim srcPres As New Presentation(file)
Dim totalWords As Integer = 0
For Each srcSld As Slide In srcPres.Slides
For Each shp As Shape In srcSld.Shapes
If shp.Placeholder IsNot Nothing Then
If TypeOf shp.Placeholder Is TextHolder Then
Dim thld As TextHolder = TryCast(shp.Placeholder, TextHolder)
Dim thldText As String = thld.Text.Replace("" & Chr(10) & “”, " “).Replace(”" & Chr(13) & “”, " “).Replace(”" & Chr(11) & “”, " “)
Dim splitParam As Char() = New Char(0) {” “c}
Dim wordsInThisTextHolder As Integer = thldText.Split(splitParam, StringSplitOptions.RemoveEmptyEntries).Length
totalWords += wordsInThisTextHolder
Continue For
End If
End If
'if
If shp.TextFrame IsNot Nothing Then
Dim tfText As String = shp.TextFrame.Text.Replace(”" & Chr(10) & “”, " “).Replace(”" & Chr(13) & “”, " “).Replace(”" & Chr(11) & “”, " “)
Dim splitParam As Char() = New Char(0) {” "c}
Dim wordsInThisTextFrame As Integer = tfText.Split(splitParam, StringSplitOptions.RemoveEmptyEntries).Length
totalWords += wordsInThisTextFrame
End If
Next
Next
Return (totalWords)
and please give your msn id so i can interact with you online
You can contact me online using Live Support and chat me there. Let me check, why word count is not right.
The code, I gave to you earlier and was in C#, works perfectly fine and gives exact word count as shown by statistics dialog box.
For your ease, I have converted into VB.NET.
You can also get the code in a text file attached by me.
Private Sub CountWords()
Dim strPath As String = "D:\downloads\"
Dim srcPres As Presentation = New Presentation(strPath & "ressources_obligatoires.ppt")
Dim totalWords As Integer = 0
For i As Integer = 1 To srcPres.Slides.LastSlidePosition
Dim srcSld As Slide = srcPres.GetSlideByPosition(i)
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, " ")
'Split the text on the basis of spaces
Dim splitParams() As Char = {" "c}
Dim wordsInThisTextHolder As Integer = thldText.Split(splitParams, StringSplitOptions.RemoveEmptyEntries).Length
'add the total words
totalWords += wordsInThisTextHolder
'continue, skip the next code and move to next iteration
Continue For
End If 'inner if
End If 'Outer if
If Not shp.TextFrame Is Nothing Then
Dim tf As TextFrame = shp.TextFrame
Dim tfText As String = tf.Text.Replace(vbCr, " ").Replace(vbLf, " ").Replace(vbVerticalTab, " ")
'Split the text on the basis of spaces
Dim splitParams() As Char = {" "c}
Dim wordsInThisTextFrame As Integer = tfText.Split(splitParams, StringSplitOptions.RemoveEmptyEntries).Length
'add the total words
totalWords += wordsInThisTextFrame
End If 'Sibling if
Next 'For each
Next 'For
Console.WriteLine("Words Count :" & totalWords)
End Sub
ok i get true value now thanks for your help
I m getting worng word count with slide contain table i m using following coding
Dim lic As Aspose.Slides.License = New Aspose.Slides.License
lic.SetLicense(HttpContext.Current.Server.MapPath(“bin”).ToString + “\” + “Aspose.Custom.lic”)
Dim srcPres As New Presentation(file)
Dim totalWords As Integer = 0
For i As Integer = 1 To srcPres.Slides.LastSlidePosition
Dim srcSld As Slide = srcPres.GetSlideByPosition(i)
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, " “)
'Split the text on the basis of spaces
Dim splitParams() As Char = {” "c}
Dim wordsInThisTextHolder As Integer = thldText.Split(splitParams, StringSplitOptions.RemoveEmptyEntries).Length
'add the total words
totalWords += wordsInThisTextHolder
'continue, skip the next code and move to next iteration
Continue For
End If 'inner if
End If 'Outer if
'add ashish 24-10
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
’ and edit ashish
If Not shp.TextFrame Is Nothing Then
Dim tf As TextFrame = shp.TextFrame
Dim tfText As String = tf.Text.Replace(vbCr, " ").Replace(vbLf, " ").Replace(vbVerticalTab, " “)
'Split the text on the basis of spaces
Dim splitParams() As Char = {” "c}
Dim wordsInThisTextFrame As Integer = tfText.Split(splitParams, StringSplitOptions.RemoveEmptyEntries).Length
'add the total words
totalWords += wordsInThisTextFrame
End If 'Sibling if
Next 'For each
Next 'For
Return (totalWords)
but then also i get worng word count can u say me why or say me techinque to get that
In my code, words inside the cells of the table were not handled. So, add a check, if shape is table, then count the number of words inside the textframe of each cell and add them in total words.
I have already shown you how to count words in a TextFrame.
So now your job is to apply the same code on Table.GetCell(col, row).TextFrame
hi this is not error skil please say me your msn id so i can talk with you online i have id of tymen but it is not online
I am online, you can now talk to me using Live Support.
i get worng word count through following code i attach files in which i get that can u please tell me why i get wrong word count and please tell me fast because i have give demo application
Dim lic As Aspose.Slides.License = New Aspose.Slides.License
lic.SetLicense(HttpContext.Current.Server.MapPath(“bin”).ToString + “\” + “Aspose.Custom.lic”)
Dim srcPres As New Presentation(file)
Dim totalWords As Integer = 0
For i As Integer = 1 To srcPres.Slides.LastSlidePosition
Dim srcSld As Slide = srcPres.GetSlideByPosition(i)
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, " “)
'Split the text on the basis of spaces
Dim splitParams() As Char = {” "c}
Dim wordsInThisTextHolder As Integer = thldText.Split(splitParams, StringSplitOptions.RemoveEmptyEntries).Length
'add the total words
totalWords += wordsInThisTextHolder
'continue, skip the next code and move to next iteration
Continue For
End If 'inner if
End If 'Outer if
'add ashish 24-10
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
’ and edit ashish
If Not shp.TextFrame Is Nothing Then
Dim tf As TextFrame = shp.TextFrame
Dim tfText As String = tf.Text.Replace(vbCr, " ").Replace(vbLf, " ").Replace(vbVerticalTab, " “)
'Split the text on the basis of spaces
Dim splitParams() As Char = {” "c}
Dim wordsInThisTextFrame As Integer = tfText.Split(splitParams, StringSplitOptions.RemoveEmptyEntries).Length
'add the total words
totalWords += wordsInThisTextFrame
End If 'Sibling if
Next 'For each
Next 'For
Return (totalWords)
Hello Akshar,
I’m afraid technical support doesn’t include writing applications for customers.
Aspose.Slides gives you access to any text in a presentation. Shakeel wrote good example for you.
API reference and programmer’s guide also available. So that is your own task to find how to
calculate number of words in a text.
i m not saying about to give me total code for the application i m just saying that how to get text from the textframe which is in the image. and if you have msn id then please give me. that so we can chat online
That is not possible to read text from images and MS PowerPoint also doesn’t allow it.
Hello Akshar,
All the text that PowerPoint considers in word count can be found in Aspose.Slides.Paragraphs collection.
So you need to check every Aspose.Slides object or property that contains a paragraphs collection.
e.g
TextFrame.Paragraphs
TextHolder.Paragraphs
Notes.Paragraphs
Click the Live Support button on the top of this website and select Aspose.Slides to start chat with me.