oWord:CentimetersToPoints( )

oWord:CentimetersToPoints( )

Postby karinha » Sun Apr 23, 2023 3:34 pm

https://forums.fivetechsupport.com/viewtopic.php?f=6&t=43084&sid=49cf627237bfc9a8329574d91789d8e4

xHarbour: CRASH.

Code: Select all  Expand view

// C:\FWH..\SAMPLES\WORDCENT.PRG

#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL oWord
   // Convert 2.5 centimeters to points
   LOCAL nPts

   oWord := WinWordObj():New()

   nPts := oWord:CentimetersToPoints( 2.5 )

   // Display the result
   MsgInfo("2.5 centimeters = " + Str(nPts) + " points")

   // Quit Word
   oWord:Quit()

RETURN NIL
/*
// Create a Word application object
// LOCAL oWord := WinWordObj():New()   // HARBOUR FUNCIONA.
*/


// FIN / END
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7808
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: oWord:CentimetersToPoints( )

Postby nageswaragunupudi » Sun Apr 23, 2023 9:05 pm

Not Correct:
Code: Select all  Expand view
 oWord := WinWordObj():New()
 


This is correct:
Code: Select all  Expand view
 oWord := WinWordObj()
 


oWord:CentimetersToPoints( n ) works with Harbour, but fails with xHarbour with runtime error.

Better we calculate like this:
nPts := nCms * 28.35
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: oWord:CentimetersToPoints( )

Postby Natter » Mon Apr 24, 2023 10:47 am

Harbour/xHarbour

#xtranslate CentimetersToPoint(<n>)=>(<n>*28.35)
#xtranslate PointToCentimeters(<n>)=>(<n>/28.35)
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: oWord:CentimetersToPoints( )

Postby karinha » Mon Apr 24, 2023 11:14 am

Gracias. Super many thanks. resuelto, resolved.

Code: Select all  Expand view


// https://forums.fivetechsupport.com/viewtopic.php?f=6&t=43084&sid=933f9771c33783191aabd62bdcb36e9e
// https://forums.fivetechsupport.com/viewtopic.php?f=3&t=43093&sid=933f9771c33783191aabd62bdcb36e9e

// C:\FWH..\SAMPLES\WORDCENT.PRG - Modificado by Jimmy/Natter/Rao.

#Include "FiveWin.ch"

// Harbour/xHarbour:
#xtranslate CentimetersToPoint(<n>)=>(<n>*28.35)
//#xtranslate PointToCentimeters(<n>)=>(<n>/28.35)
#xtranslate PointToCentimeters(<n>)=>(<n>*28.35)

FUNCTION Main()

   LOCAL oWord, nCms
   // Convert 2.5 centimeters to points
   LOCAL nPts

   oWord := WinWordObj()

   oWord := CreateObject("Word.Application")

   IF EMPTY( oWord )

      MsgInfo( "Microsoft Word not installied" )

      RETURN NIL

   ENDIF

   #ifdef __XHARBOUR__

      nPts := PointToCentimeters( 2.5 )        // xHarbour

   #else

      nPts := oWord:CentimetersToPoints( 2.5 ) // Harbour

   #endif

   // nCms := 2.5
   // nPts := nCms * 28.35

   // Display the result
   MsgInfo("2.5 centimeters = " + Str(nPts) + " points")

   // Quit Word
   oWord:Quit()

RETURN NIL

// FIN / END
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7808
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: oWord:CentimetersToPoints( )

Postby karinha » Mon Apr 24, 2023 11:41 am

I just need to figure out what this error is:

Solo necesito averiguar qué es este error:

https://forums.fivetechsupport.com/viewtopic.php?f=6&t=43084&sid=4132bd3592f232a9b39f43dfc43e989c&sid=933f9771c33783191aabd62bdcb36e9e#p259210

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7808
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 59 guests