Estoy intentando calcular la cantidad de letras, palabras y párrafos que tiene cada contenedor de texto en una diapositiva.
He buscado en Internet y aún no encuentro ejemplos de como hacerlo.
Hasta el momento cuento con el siguiente código
Código: Seleccionar todo
Sub Revisando_texto_letras_palabras_Y_parrafos_Slides
'----------------------------------
'Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
numslides = Thiscomponent.getDrawPages.Count
if numslides>0 then
'------------------------ Slide 1
oDraw = ThisComponent.Drawpages.getByIndex(0)
numshapes=oDraw.getCount()
For i = 0 To oDraw.getCount() - 1
oObj = oDraw.getByIndex(i)
tiposhape=oObj.getShapeType
select1=Thiscomponent.CurrentController.select(oObj)
if tiposhape="com.sun.star.presentation.TitleTextShape" or tiposhape="com.sun.star.presentation.OutlinerShape" then
' mri oObj.text.createenumeration
'mri oText.text
oText = oObj.getText()
' stop
oCurs = oText.createTextCursor()
ParagraphEnum = oText.createEnumeration
While ParagraphEnum.hasMoreElements
Paragraph = ParagraphEnum.nextElement
msgbox Paragraph.getstring
oCurs.gotoRange(Paragraph.Anchor,true) ' supondo que seleccionando el texto dentro del shape se podría
'.--... solo un intento
PortionEnum = Paragraph.createEnumeration
' esto para saber la fuente por si usan distintas en el mismo parrafo, taqmbien lo necesito
While PortionEnum.hasMoreElements
Portion = PortionEnum.nextElement
If Portion.String <> "" Then
FontName = Portion.CharFontName
' Print FontName
End if
Wend
Wend '
endif
next
endif
end sub
Mis agradecimientos anticipados por la colaboración