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

From Apache OpenOffice Wiki
Jump to: navigation, search
(Initial author Sun Microsystems, Inc.)
 
m
(5 intermediate revisions by 3 users not shown)
Line 8: Line 8:
 
|NextPage=Documentation/DevGuide/ProUNO/Bridge/Mapping of String
 
|NextPage=Documentation/DevGuide/ProUNO/Bridge/Mapping of String
 
}}
 
}}
 +
{{Documentation/DevGuideLanguages|Documentation/DevGuide/ProUNO/Bridge/{{SUBPAGENAME}}}}
 
{{DISPLAYTITLE:Mapping of Hyper and Decimal}}
 
{{DISPLAYTITLE:Mapping of Hyper and Decimal}}
 
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.  
 
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.  
Line 14: 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.
Line 23: Line 25:
  
 
{{PDL1}}
 
{{PDL1}}
[[Category: Professional UNO]]
+
 
 +
[[Category:Documentation/Developer's Guide/Professional UNO]]

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