Difference between revisions of "Documentation/DevGuide/ProUNO/Bridge/Mapping of Hyper and Decimal"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (FINAL VERSION FOR L10N)
m
 
Line 15: Line 15:
  
 
Visual Basic has the restriction that Decimal variables can only be declared as Variants. The assignment of a value has to be done using the CDec function. Furthermore, VB does not allow the use of integer literals bigger than 4 bytes. As a workaround, you can provide a string that contains the value. For example:
 
Visual Basic has the restriction that Decimal variables can only be declared as Variants. The assignment of a value has to be done using the CDec function. Furthermore, VB does not allow the use of integer literals bigger than 4 bytes. As a workaround, you can provide a string that contains the value. For example:
 
+
<source lang="vb">
 
   Dim aHyper As Variant
 
   Dim aHyper As Variant
 
   aHyper = CDec("9223372036854775807")
 
   aHyper = CDec("9223372036854775807")
 +
</source>
  
 
Visual Basic .NET has the build-in type decimal and does not restrict the integer literals.
 
Visual Basic .NET has the build-in type decimal and does not restrict the integer literals.

Latest revision as of 12:42, 22 October 2009



Automation does not have an 8 byte integer value that compares to a UNO hyper. However, the Automation type Decimal has a value space big enough to represent a hyper. Therefore, when calling UNO methods from Automation, use Decimal whenever the UNO method requires a hyper or unsigned hyper.

The Decimal type may not be supported by all Automation capable language. Examples are JScript and VBScript, which should not be used when calling these UNO methods. This is because provided values may be rounded and hence the results are tainted.

Visual Basic has the restriction that Decimal variables can only be declared as Variants. The assignment of a value has to be done using the CDec function. Furthermore, VB does not allow the use of integer literals bigger than 4 bytes. As a workaround, you can provide a string that contains the value. For example:

  Dim aHyper As Variant
  aHyper = CDec("9223372036854775807")

Visual Basic .NET has the build-in type decimal and does not restrict the integer literals.

When Automation objects are called from UNO, then the com.sun.star.bridge.oleautomation.Decimal type can be used to provide arguments with the Automation arguments of type Decimal. Returned Decimal values are converted to com.sun.star.bridge.oleautomation.Decimal .

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages