To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=42366
                  Issue #:|42366
                  Summary:|getText().getString() can crash OOo if there are no
                          |paragraphs
                Component:|api
                  Version:|680m74
                 Platform:|All
                      URL:|
               OS/Version:|All
                   Status:|UNCONFIRMED
        Status whiteboard:|
                 Keywords:|
               Resolution:|
               Issue type:|DEFECT
                 Priority:|P3
             Subcomponent:|code
              Assigned to:|sw
              Reported by:|pitonyak





------- Additional comments from [EMAIL PROTECTED] Wed Feb  9 09:18:53 -0800 
2005 -------
The following behavior was tested using 1.1.3, 1.1.4, and the development build 
74.

If a text object contains "<paragraph>, <Table>, <paragraph>", then all of the
text is returned using ThisComponent.getText().getString().

If a text object contains "<Table>, <paragraph>", then only the text in the
paragraph is returned using ThisComponent.getText().getString().

If a text object contains "<Table>", Then OpenOffice.org CRASHES if you call
ThisComponent.getText().getString().

I first saw this behavior for a text Header and/or Footer that ONLY contained a
text object. You are not likely to find a document that ONLY contains a text
table. More likely in a header or footer. Luckily, when the error occurs for a
header or footer, it only stops the macro and does not crash OOo.

for a text document, however, OOo crashes.

Create a text document and then delete all of the paragraphs. You can use a
macro such as the following if you desire (after creating a text table).

Sub DoIt
  MsgBox ThisComponent.getText().getString()
  DeletePars(ThisComponent.getText())
  MsgBox ThisComponent.getText().getString()
End Sub

Sub DeletePars(oText)
  Dim oParEnum 'Paragraph enumerator
  Dim oPar 'Current paragraph
  oParEnum = oText.createEnumeration()
  Do While oParEnum.hasMoreElements()
    oPar = oParEnum.nextElement()
    If oPar.supportsService("com.sun.star.text.Paragraph") Then
      oText.removeTextContent(oPar)
    End If
  Loop
End Sub

This macro will be included in the document that I attach.

I expected getString() to work even if the first thing found is a table. I never
expect OOo to crash from this.

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to