Συνάρτηση CreateUnoValue
Επιστρέφει ένα αντικείμενο που αντιπροσωπεύει μια αυστηρά δηλωμένη τιμή που αναφέρεται στο σύστημα τύπων Uno.
Αυτό το αντικείμενο μετατρέπεται αυτόματα σε Any του αντίστοιχου τύπου όταν περνιέται σε Uno. Ο τύπος πρέπει να οριστεί από το πλήρως κατάλληλο όνομα τύπου Uno.
Το LibreOffice API συχνά χρησιμοποιεί τον τύπο Any. Είναι το αντίστοιχο του τύπου Variant που είναι γνωστό από άλλα περιβάλλοντα. Ο τύπος Any περιέχει έναν αυθαίρετο τύπο Uno και χρησιμοποιείται στις γενικές διεπαφές Uno.
oUnoValue = CreateUnoValue( "[]byte", MyBasicValue ) ' για να πάρετε την αλληλουχία byte.
Εάν το CreateUnoValue δεν μπορεί να μετατραπεί στον καθορισμένο τύπο Uno, συμβαίνει σφάλμα. Για τη μετατροπή, χρησιμοποιείται η υπηρεσία TypeConverter.
This function is intended for use in situations where the default Basic to Uno type converting mechanism is insufficient. This can happen when you try to access generic Any based interfaces, such as XPropertySet::setPropertyValue( Name, Value ) or X???Container::insertBy???( ???, Value ), from LibreOffice Basic. The Basic runtime does not recognize these types as they are only defined in the corresponding service.
In this type of situation, LibreOffice Basic chooses the best matching type for the Basic type that you want to convert. However, if the wrong type is selected, an error occurs. You use the CreateUnoValue() function to create a value for the unknown Uno type.
You can also use this function to pass non-Any values, but this is not recommend. If Basic already knows the target type, using the CreateUnoValue() function will only lead to additional converting operations that slow down the Basic execution.