Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


2013/5/8 Vieri <rentorbuy@yahoo.com>:
--- On Tue, 5/7/13, Vieri <rentorbuy@yahoo.com> wrote:

--- On Mon, 5/6/13, Andrew Douglas
Pitonyak <andrew@pitonyak.org>
wrote:

On 05/06/2013 05:21 AM, Vieri wrote:
Hi,

I have an odt writer document with 2 input text
fields
(added with the form designer toolbar). I manually type
text
into one of the fields. I copy/pasted a macro to see if
I
could grab the text within the input field but haven't
had
any luck. This is the test macro in Basic:

Sub EnumerateFields
   vEnum =
ThisComponent.getTextFields().createEnumeration()
   If Not IsNull(vEnum) Then
     If vEnum.hasMoreElements() Then
       Print "OK"
     Else
       Print "NOT OK"
     End If
   End If
End Sub

If I manually run this macro I get the "NOT OK"
message.

What am I doing wrong?
What is the correct way of getting the text field
elements?

Thanks

Vieri



I grabbed these two routines from my test modules
without
running them first....

Hi,

Thanks for the reply but I'm still having trouble.
I'm either way off-course, misusing LO or making a dumb
rookie mistake.

I copied your macros to my odt document.
I then did a "tools, macros, run macro..." and selected the
Subs I copied.
If I run EnumerateTextFields then it yields the "Finished"
message box (nothing else).
If I run DisplayMasterFields then it yields the following
message:

===Text Field Masters===
(com.sun.star.text.fieldmaster.SetExpression.Illustration,Illustration)
(com.sun.star.text.fieldmaster.SetExpression.Table,Table)
(com.sun.star.text.fieldmaster.SetExpression.Text,Text)
(com.sun.star.text.fieldmaster.SetExpression.Drawing,Drawing)

My odt document has 2 input fields in a form.

By the way, if I place a button within my form and configure
the "Mouse button pressed" to launch, say,
EnumerateTextFields then I get the following error message:
"LibreOffice 4.0.2.2 BASIC runtime error. '423'
getTextFields" and it points at the line:
"oEnum = oDoc.getTextFields().createEnumeration()"

I'm stuck on something that should be quite simple.
I'm attaching my odt file hoping that someone can tell me
what novice mistake I'm making.

Trying to attach the file again but it seems that the mailing list strips it out.

Thanks,

Vieri
--

Yes, that's the default behaviour for most mailing lists, I think. Not
that it matters anymore, since you seem to have your problem solved,
but next time you could upload the file somewhere and just give us the
link here.


Johnny Rosenberg

-- 
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.