Darragh Sherwin wrote:
Hi Albert,
Please use the mailing list in future, you will get a quicker and better response.
Unfortunately, it has been a while since I looked at this code,
I don't think it will work.
The problem is that each paragraph contains so much formatting attributes, etc that would have to compare all these attributes.
The only thing you could do, is a string compare on the text of the paragraphs, see below.
Albert Palma Xicola wrote:
hi , I want to automate compare documents in SBasic. I have this code i see it in one of your mail,but i don’t work good:
I am not familiar with StarBasic, Andrew Pitoyak's Macro Document is a good starting point
Set objServiceManager = CreateObject("com.sun.star.ServiceManager")
Set Desktop = objServiceManager.CreateInstance("com.sun.star.frame.Desktop")
Set Doc1 = Desktop.loadComponentFromURL("file:///c:/a.sxc", "_blank", 0, arg())
Set Doc2 = Desktop.loadComponentFromURL("file:///c:/b.sxc", "_blank", 0, arg())
Set paragraphs_doc1 = Doc1.Text.createEnumeration() ‘here it give me a error: 'RUNTIME ERROR 438: OBJECT DOES NOT SUPPORT THIS PROPERTY OR METHOD
Should it not be "var paragraphs_doc1 = ....."?
paragraphs_doc2 = Doc2.Text.createEnumeration()
Do While (paragraphs_doc1.hasMoreElements() And paragraphs_doc2.hasMoreElements())
paragraph_doc1 = paragraphs_doc1.nextElement() paragraph_doc2 = paragraphs_doc2.nextElement()
If (Not paragraph_doc1.supportsService("com.sun.star.text.TextTable") Or Not paragraph_doc2.supportsService("com.sun.star.text.TextTable")) Then
textenum_doc1 = paragraph_doc1.createEnumeration()
textenum_doc2 = paragraph_doc2.createEnumeration()
Do While (textenum_doc1.hasMoreElements() And textenum_doc2.hasMoreElements())
textrange_doc1 = textenum_doc1.nextElement()
textrange_doc2 = textenum_doc2.nextElement()
string1 = textrange_doc1.getString() string2 = textrange_doc2.getString()
If (string1 <> string2) Then
' There is a textrange comparator
' have a look at the API for this
' Text ranges not equal
'return false
End If
End If
Loop
'return true
I see this code in your mail,but i was in java and i translate in sbasic,can you help me with it?
Thx for all!
What happens if you change
Set paragraphs_doc1 = Doc1.Text.createEnumeration()
To
Set paragraphs_doc1 = Doc1.getText().createEnumeration()
Please respond directly to the list....
-- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm Free Info: http://www.pitonyak.org/oo.php
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
