public List GetWord()
{
var elements = new List();
XEnumerationAccess xEnumerationAccess = (XEnumerationAccess)_textDocument.getText();
XEnumeration xEnumeration = xEnumerationAccess.createEnumeration();
// Loop over all text elements
while (xEnumeration.hasMoreElements())
{
object nextElement = xEnumeration.nextElement();
XServiceInfo xServiceInfo = nextElement as XServiceInfo;
if (xServiceInfo != null)
{
if (xServiceInfo.supportsService("com.sun.star.text.TextTable"))
{
elements.Add("Table: " + nextElement.ToString());
}
if (xServiceInfo.supportsService("com.sun.star.text.Paragraph"))
{
XTextRange xTextRange = nextElement as XTextRange;
if (xTextRange != null)
{
string paragraphText = xTextRange.getString();
elements.Add("Paragraph: " + paragraphText);
}
}
}
}
return elements;
}
i am doing like this to get the text value of the document but i am unable to do it. can any one help me to get the text elements from the word document