oWord:CentimetersToPoints() en xHarbour

oWord:CentimetersToPoints() en xHarbour

Postby karinha » Sat Apr 22, 2023 4:12 pm

Buenas,

No funciona en xHarbour porque?

odoc:PageSetup:TopMargin := oWord:CentimetersToPoints( 2.5 )

Error:

Erro! A entrada de AutoTexto não foi definida.

¡Error! La entrada de Autotexto no se ha definido.

Que falta? Como defino Autotexto ?

Compila bien con Harbour y xharbour:

Code: Select all  Expand view

#include "FiveWin.ch"

/* ****************************************************************************
GERAR ARQUIVOS EM WORD USANDO HARBOUR
por cjp
Segue meu código completo, exatamente como retirei do post acima:

hbmk2 -run TstHb2Word.prg hbwin.hbc

hbmk2: Processando opções do ambiente: -comp=mingw
Harbour 3.4.0dev () (2017-12-20 13:40)
Copyright (c) 1999-2017, https://github.com/vszakats/harbour-core/

******************************************************************************/



/* TRY / CATCH / FINALLY / END */
#ifdef __XHARBOUR__
// nada a fazer.

#else // ?? En fivewin? creo que no necesite.

// #xcommand TRY => BEGIN SEQUENCE WITH __BreakBlock()
// #xcommand CATCH [<!oErr!>] => RECOVER [USING <oErr>] <-oErr->
// #xcommand FINALLY => ALWAYS

#endif

// Enumeração WdOrientation (Word)
//
// Especifica uma orientação do layout de página.
// Nome Valor   Descrição
//
#define wdOrientLandscape   1   // Orientação em paisagem.
#define wdOrientPortrait    0   // Orientação em retrato.

// Enumeração WdPaperSize (Word)
//
// Especifica do layout de página.
// Nome Valor   Descrição
//
#define wdPaper10x14                0    // 10 inches wide, 14 inches long.
#define wdPaper11x17                1    // Legal 11 inches wide, 17 inches long.
#define wdPaperA3                   6    // A3 dimensions.
#define wdPaperA4                   7    // A4 dimensions.
#define wdPaperA4Small              8    // Small A4 dimensions.
#define wdPaperA5                   9    // A5 dimensions.
#define wdPaperB4                   10   // B4 dimensions.
#define wdPaperB5                   11   // B5 dimensions.
#define wdPaperCSheet               12   // C sheet dimensions.
#define wdPaperCustom               41   // Custom paper size.
#define wdPaperDSheet               13   // D sheet dimensions.
#define wdPaperEnvelope10           25   // Legal envelope, size 10.
#define wdPaperEnvelope11           26   // Envelope, size 11.
#define wdPaperEnvelope12           27   // Envelope, size 12.
#define wdPaperEnvelope14           28   // Envelope, size 14.
#define wdPaperEnvelope9            24   // Envelope, size 9.
#define wdPaperEnvelopeB4           29   // B4 envelope.
#define wdPaperEnvelopeB5           30   // B5 envelope.
#define wdPaperEnvelopeB6           31   // B6 envelope.
#define wdPaperEnvelopeC3           32   // C3 envelope.
#define wdPaperEnvelopeC4           33   // C4 envelope.
#define wdPaperEnvelopeC5           34   // C5 envelope.
#define wdPaperEnvelopeC6           35   // C6 envelope.
#define wdPaperEnvelopeC65          36   // C65 envelope.
#define wdPaperEnvelopeDL           37   // DL envelope.
#define wdPaperEnvelopeItaly        38   // Italian envelope.
#define wdPaperEnvelopeMonarch      39   // Monarch envelope.
#define wdPaperEnvelopePersonal     40   // Personal envelope.
#define wdPaperESheet               14   // E sheet dimensions.
#define wdPaperExecutive            5    // Executive dimensions.
#define wdPaperFanfoldLegalGerman   15   // German legal fanfold dimensions.
#define wdPaperFanfoldStdGerman     16   // German standard fanfold dimensions.
#define wdPaperFanfoldUS            17   // United States fanfold dimensions.
#define wdPaperFolio                18   // Folio dimensions.
#define wdPaperLedger               19   // Ledger dimensions.
#define wdPaperLegal                4    // Legal dimensions.
#define wdPaperLetter               2    // Letter dimensions.
#define wdPaperLetterSmall          3    // Small letter dimensions.
#define wdPaperNote                 20   // Note dimensions.
#define wdPaperQuarto               21   // Quarto dimensions.
#define wdPaperStatement            22   // Statement dimensions.
#define wdPaperTabloid              23   // Tabloid dimensions.

// Enumeração WdSeekView (Word)
//
// Especifica o elemento do documetno a ser exibido no modo de exibição de layout de impressão.
// Nome Valor   Descrição
//
#define wdSeekCurrentPageFooter 10  // O rodapé da página atual.
#define wdSeekCurrentPageHeader 9   // O cabeçalho da página atual.
#define wdSeekEndnotes          8   // Notas de fim.
#define wdSeekEvenPagesFooter   6   // O rodapé das páginas pares.
#define wdSeekEvenPagesHeader   3   // O cabeçalho das páginas pares.
#define wdSeekFirstPageFooter   5   // O rodapé da primeira página.
#define wdSeekFirstPageHeader   2   // O cabeçalho da primeira página.
#define wdSeekFootnotes         7   // Rodapés.
#define wdSeekMainDocument      0   // O documento principal.
#define wdSeekPrimaryFooter     4   // O rodapé primário.
#define wdSeekPrimaryHeader     1   // O cabeçalho primário.

// Enumeração WdParagraphAlignment (Word)
//
// Especifica o alinhamento de um parágrafo.
// Nome Valor   Descrição
//
#define wdAlignParagraphCenter        1    // Alinhamento centralizado.
#define wdAlignParagraphDistribute    4    // Os caracteres do parágrafo são distribuídos para preencher toda a largura do parágrafo.
#define wdAlignParagraphJustify       3    // Totalmente justificado.
#define wdAlignParagraphJustifyHi     7    // Justificado com uma alta taxa de compactação do caractere.
#define wdAlignParagraphJustifyLow    8    // Justificado com uma baixa taxa de compactação do caractere.
#define wdAlignParagraphJustifyMed    5    // Justificado com uma taxa média de compactação do caractere.
#define wdAlignParagraphLeft          0    // Alinhamento à esquerda.
#define wdAlignParagraphRight         2    // Alinhamento à direita.
#define wdAlignParagraphThaiJustify   9    // Justificado de acordo com o layout de formatação tailandês.

// Enumeração WdConstants (Word)
//
// Esta enumeração agrupa as constantes utilizadas com vários métodos do Microsoft Word.
// Nome Valor   Descrição
//
#define wdAutoPosition  0             // Representa o valor Auto da definição especificada.
#define wdBackward      -1073741823   // Indica que a seleção será estendida para trás usando o método MoveStartUntil ou MoveStartWhile do objeto Range ou Selection.
#define wdCreatorCode   1297307460    // Representa o código do criador dos objetos criados pelo Microsoft Word.
#define wdFirst         1             // Representa o primeiro item em uma coleção.
#define wdForward       1073741823    // Indica que a seleção será estendida sequencial usando o método MoveStartUntil ou MoveStartWhile do objeto Range ou Selection.
#define wdToggle        9999998       // Alterna um valor de propriedade.
#define wdUndefined     9999999       // Representa um valor não definido.

// Enumeração WdLineStyle (Word)
//
// Especifica o estilo de linha da borda de um objeto.
// Nome Valor   Descrição
//
#define wdLineStyleDashDot                 5    // Um travessão seguido por um ponto.
#define wdLineStyleDashDotDot              6    // Um travessão seguido por dois pontos.
#define wdLineStyleDashDotStroked          20   // Um travessão seguido por um traço pontilhado e, em seguida, se tornando uma borda semelhante a um poste listrado.
#define wdLineStyleDashLargeGap            4    // Um travessão seguido por uma grande lacuna.
#define wdLineStyleDashSmallGap            3    // Um travessão seguido por uma pequena lacuna.
#define wdLineStyleDot                     2    // Pontos.
#define wdLineStyleDouble                  7    // Linhas duplas sólidas.
#define wdLineStyleDoubleWavy              19   // Linhas duplas e onduladas sólidas.
#define wdLineStyleEmboss3D                21   // A borda parece ter uma aparência em alto relevo 3D.
#define wdLineStyleEngrave3D               22   // A borda parece ter uma aparência de baixo relevo 3D.
#define wdLineStyleInset                   24   // A borda parece estar em baixo-relevo.
#define wdLineStyleNone                    0    // Sem borda.
#define wdLineStyleOutset                  23   // A borda parece estar em alto relevo.
#define wdLineStyleSingle                  1    // Uma única linha sólida.
#define wdLineStyleSingleWavy              18   // Uma única linha ondulada e sólida.
#define wdLineStyleThickThinLargeGap       16   // Uma única linha interna sólida e espessa envolta por uma única linha sólida e fina com uma grande lacuna entre elas.
#define wdLineStyleThickThinMedGap         13   // Uma única linha interna sólida e espessa envolta por uma única linha sólida e fina com uma lacuna média entre elas.
#define wdLineStyleThickThinSmallGap       10   // Uma única linha interna sólida e espessa envolta por uma única linha sólida e fina com uma pequena lacuna entre elas.
#define wdLineStyleThinThickLargeGap       15   // Uma única linha interna sólida e fina envolta por uma única linha sólida e espesssa com uma grande lacuna entre elas.
#define wdLineStyleThinThickMedGap         12   // Uma única linha interna sólida e fina envolta por uma única linha sólida e espessa com uma lacuna média entre elas.
#define wdLineStyleThinThickSmallGap       9    // Uma única linha interna sólida e fina envolta por uma única linha sólida e espessa com uma pequena lacuna entre elas.
#define wdLineStyleThinThickThinLargeGap   17   // Uma única linha interna sólida e fina envolta por uma única linha sólida e espessa envolta por uma única linha sólida e fina com uma grande lacuna entre todas as linhas☺.
#define wdLineStyleThinThickThinMedGap     14   // Uma única linha interna sólida e fina envolta por uma única linha sólida e espessa envolta por uma única linha sólida e fina com uma lacuna média entre todas as linhas?.
#define wdLineStyleThinThickThinSmallGap   11   // Uma única linha interna sólida e fina envolta por uma única linha sólida e espessa envolta por uma única linha sólida e fina com uma pequena lacuna entre todas as linhas?.
#define wdLineStyleTriple                  8    // Três linhas sólidas e finas.

// Enumeração WdCellVerticalAlignment (Word)
//
// Define o alinhamento vertical do texto em uma ou mais células de uma tabela.
// Nome Valor   Descrição
//
#define wdCellAlignVerticalBottom   3   // O texto é alinhado à borda inferior da célula.
#define wdCellAlignVerticalCenter   1   // O texto é alinhado ao centro da célula.
#define wdCellAlignVerticalTop      0   // O texto é alinhado à borda superior da célula.

// Enumeração WdUnits (Word)
//
// Especifica uma unidade de medida a ser utilizada.
// Nome Valor   Descrição
//
#define wdCell                  12   // Uma célula.
#define wdCharacter             1    // Um caractere.
#define wdCharacterFormatting   13   // Formatação do caractere.
#define wdColumn                9    // Uma coluna.
#define wdItem                  16   // O item selecionado.
#define wdLine                  5    // Uma linha.
#define wdParagraph             4    // Um parágrafo.
#define wdParagraphFormatting   14   // Formatação do parágrafo.
#define wdRow                   10   // Uma linha.
#define wdScreen                7    // As dimensões da tela.
#define wdSection               8    // Uma seção.
#define wdSentence              3    // Uma frase.
#define wdStory                 6    // Uma história.
#define wdTable                 15   // Uma tabela.
#define Essa                    11   // Uma janela.
#define wdWord                  2    // Uma palavra.

// Enumeração WdCollapseDirection
//
#define wdCollapseEnd     0  // Collapse the range to the ending point.
#define wdCollapseStart   1  // Collapse the range to the starting point.

// Enumeração WdFieldType (Word)
//
// Especifica um campo do Microsoft Word. A menos que seja especificado de outra forma, os tipos de campo descritos nesta enumeração podem ser adicionados interativamente a um documento do Word utilizando a caixa de diálogo Campo. Consulte a Ajuda do Word para obter mais informações sobre os códigos de campo específicos.
// Nome Valor   Descrição

#define wdFieldAddin             81   // Campo do suplemento. Não disponível na caixa de diálogo Campo. Utilizado para armazenar dados ocultos da interface do usuário.
#define wdFieldAddressBlock      93   // Campo AddressBlock.
#define wdFieldAdvance           84   // Campo Advance.
#define wdFieldAsk               38   // Campo Ask.
#define wdFieldAuthor            17   // Campo Author.
#define wdFieldAutoNum           54   // Campo AutoNum.
#define wdFieldAutoNumLegal      53   // Campo AutoNumLgl.
#define wdFieldAutoNumOutline    52   // Campo AutoNumOut.
#define wdFieldAutoText          79   // Campo AutoText.
#define wdFieldAutoTextList      89   // Campo AutoTextList.
#define wdFieldBarCode           63   // Campo BarCode.
#define wdFieldBidiOutline       97   // Campo BidiOutline.
#define wdFieldComments          92   // Campo Comments.
#define wdFieldCompare           96   // Campo Compare.
#define wdFieldCreateDate        19   // Campo CreateDate.
#define wdFieldData              80   // Campo Data.
#define wdFieldDatabase          21   // Campo Database.
#define wdFieldDate              40   // Campo Date.
#define wdFieldDDE               78   // Campo DDE. Não está mais disponível na caixa de diálogo Campo, mas oferece suporte a documentos criados em versões anteriores do Word.
#define wdFieldDDEAuto           31   // Campo DDEAuto. Não está mais disponível na caixa de diálogo Campo, mas oferece suporte a documentos criados em versões anteriores do Word.
#define wdFieldDisplayBarcode    45   // Campo DisplayBarcode.
#define wdFieldDocProperty       46   // Campo DocProperty.
#define wdFieldDocVariable       99   // Campo DocVariable.
#define wdFieldEditTime          85   // Campo EditTime.
#define wdFieldEmbed             64   // Campo Embedded.
#define wdFieldEmpty             25   // Campo Empty. Atua como um espaço reservado para o conteúdo de campo que ainda não foi adicionado. Um campo adicionado por meio das teclas Ctrl+F9 na interface do usuário é um campo Empty.
#define wdFieldExpression        58   // Campo = (Fórmula).
#define wdFieldFileName          -1   // Campo FileName.
#define wdFieldFileSize          34   // Campo FileSize.
#define wdFieldFillIn            29   // Campo Fill-In.
#define wdFieldFootnoteRef       69   // Campo FootnoteRef. Não disponível na caixa de diálogo Campo. Inserido por meio de programação ou interação.
#define wdFieldFormCheckBox      39   // Campo FormCheckBox.
#define wdFieldFormDropDown      5    // Campo FormDropDown.
#define wdFieldFormTextInput     71   // Campo FormText.
#define wdFieldFormula           83   // Campo EQ (Equação).
#define wdFieldGlossary          70   // Campo Glossary. Não é mais oferecido suporte para este campo no Word.
#define wdFieldGoToButton        49   // Campo GoToButton.
#define wdFieldGreetingLine      47   // Campo GreetingLine.
#define wdFieldHTMLActiveX       50   // Campo HTMLActiveX. Não é oferecido suporte atualmente para este campo.
#define wdFieldHyperlink         94   // Campo Hyperlink.
#define wdFieldIf                91   // Se o campo.
#define wdFieldImport            88   // Campo Import. Não pode ser adicionado pela caixa de diálogo Campo, mas pode ser adicionado de forma interativa ou por código.
#define wdFieldInclude           7    // Campo Include. Não pode ser adicionado pela caixa de diálogo Campo, mas pode ser adicionado de forma interativa ou por código.
#define wdFieldIncludePicture    55   // Campo IncludePicture.
#define wdFieldIncludeText       36   // Campo IncludeText.
#define wdFieldIndex             67   // Campo Index.
#define wdFieldIndexEntry        68   // Campo XE (Entrada de índice).
#define wdFieldInfo              8    // Campo Info.
#define wdFieldKeyWord           4    // Campo Keywords.
#define wdFieldLastSavedBy       14   // Campo LastSavedBy.
#define wdFieldLink              18   // Campo Link.
#define wdFieldListNum           20   // Campo ListNum.
#define wdFieldMacroButton       56   // Campo MacroButton.
#define wdFieldMergeBarcode      90   // Campo MergeBarcode.
#define wdFieldMergeField        51   // Campo MergeField.
#define wdFieldMergeRec          98   // Campo MergeRec.
#define wdFieldMergeSeq          59   // Campo MergeSeq.
#define wdFieldNext              44   // Campo Next.
#define wdFieldNextIf            75   // Campo NextIf.
#define wdFieldNoteRef           41   // Campo NoteRef.
#define wdFieldNumChars          42   // Campo NumChars.
#define wdFieldNumPages          72   // Campo NumPages.
#define wdFieldNumWords          28   // Campo NumWords.
#define wdFieldOCX               26   // Campo OCX. Não pode ser adicionado pela caixa de diálogo Campo, mas pode ser adicionado pelo código utilizando o método AddOLEControl da coleção Shapes ou InlineShapes.
#define wdFieldPage              27   // Campo Page.
#define wdFieldPageRef           87   // Campo PageRef.
#define wdFieldPrint             33   // Campo Print.
#define wdFieldPrintDate         37   // Campo PrintDate.
#define wdFieldPrivate           48   // Campo Private.
#define wdFieldQuote             23   // Campo Quote.
#define wdFieldRef               77   // Campo Ref.
#define wdFieldRefDoc            35   // Campo RD (Documento de referência).
#define wdFieldRevisionNum       3    // Campo RevNum.
#define wdFieldSaveDate          11   // Campo SaveDate.
#define wdFieldSection           24   // Campo Section.
#define wdFieldSectionPages      22   // Campo SectionPages.
#define wdFieldSequence          65   // Campo Seq (Sequência).
#define wdFieldSet               66   // Campo Set.
#define wdFieldShape             12   // Campo Shape. Criado automaticamente para qualquer figura desenhada.
#define wdFieldSkipIf            6    // Campo SkipIf.
#define wdFieldStyleRef          95   // Campo StyleRef.
#define wdFieldSubject           43   // Campo Subject.
#define wdFieldSubscriber        10   // Somente Macintosh. (Para obter informações sobre esta constante, consulte a ajuda de referência da linguagem incluída com o Microsoft Office Macintosh Edition.)
#define wdFieldSymbol            16   // Campo Symbol.
#define wdFieldTemplate          82   // Campo Template.
#define wdFieldTime              57   // Campo Time.
#define wdFieldTitle             30   // Campo Title.
#define wdFieldTOA               32   // Campo TOA (Índice de autoridades).
#define wdFieldTOAEntry          15   // Campo TOA (Entrada do índice de autoridades).
#define wdFieldTOC               73   // Campo TOC (Sumário).
#define wdFieldTOCEntry          74   // Campo TOC (Entrada do sumário).
#define wdFieldUserAddress       13   // Campo UserAddress.
#define wdFieldUserInitials      9    // Campo UserInitials.
#define wdFieldUserName          62   // Campo UserName.
#define wdFieldBibliography      61   // Campo Bibliography.
#define wdFieldCitation          60   // Campo Citation.

// Enumeração WdProtectionType (Word)
//
// Especifica o tipo de proteção aplicado ao documento atual.
// Nome Valor   Descrição
//
#define wdAllowOnlyComments     1    // Permite que somente comentários sejam adicionados ao documento.
#define wdAllowOnlyFormFields   2    // Permite que o conteúdo seja adicionado ao documento somente através dos campos de formulário.
#define wdAllowOnlyReading      3    // Permite somente acesso de leitura ao documento.
#define wdAllowOnlyRevisions    0    // Permite que sejam feitas revisões somente ao conteúdo existente.
#define wdNoProtection          -1   // Não aplica proteção ao documento.

// Enumeração WdVerticalAlignment (Word)
//
// Especifica o tipo de alinhamento vertical a ser aplicado.
// Nome Valor   Descrição
//
#define wdAlignVerticalBottom   3   // Alinhamento vertical inferior.
#define wdAlignVerticalCenter   1   // Alinhamento vertical centralizado.
#define wdAlignVerticalJustify  2   // Alinhamento vertical justificado.
#define wdAlignVerticalTop      0   // Alinhamento vertical superior.

FUNCTION Main()

   LOCAL cFileName := "C:\TEMP\TestWord.doc"

   MEMVAR vtbl

   PRIVATE vtbl := { { "CM0001", "MK", 0.00, 1.000, 2.00, 9.000, 0.00 }, ;
                     { "CM0002", "MK", 0.00, 1.000, 2.00, 9.000, 0.00 }, ;
                     { "CM0003", "MK", 0.00, 1.000, 2.00, 9.000, 0.00 }, ;
                     { "CM0004", "MK", 0.00, 1.000, 2.00, 9.000, 0.00 }, ;
                     { "CM0005", "MK", 0.00, 1.000, 2.00, 9.000, 0.00 }, ;
                     { "CM0006", "MK", 0.00, 1.000, 2.00, 9.000, 0.00 }, ;
                     { "CM0007", "MK", 0.00, 1.000, 2.00, 9.000, 0.00 } ;
                   }

   HB_GCALL( .F. )

   IF .NOT. lIsDir( "C:\TEMP" )
      lMkDir( UPPER( "C:\TEMP" ) )
   ENDIF

   SET CENTURY ON
   SET DATE BRITISH
   SET TIME FORMAT TO "HH:MM:SS"
   SET EPOCH TO YEAR( DATE() ) - 30

   // Crear el .DOC
   Table_Form( vtbl, cFileName )

//   Imprime_Word( cFileName )  // PRINT .DOC

   HB_GCALL( .T. )

   CLEAR MEMORY

   PostQuitMessage( 0 )

   QUIT

RETURN NIL

FUNCTION table_form( vtbl, cFileName )

   // Parameter vtbl -> order data array para vtbl
   LOCAL oWord, __text, oDoc, __AUTO, OPR1, RNG1, OTB1, OPR2, RNG2, OPR3
   LOCAL OTB2, OPR4, RNG4, OPR5, RNG5, OTB3, __MENS, OPR6, RNG6
   LOCAL RNG3, VCAB, OPRA, RNGA, NROW, NCOL, OTB4, IC, I, J, CRNG, FORMULA

   #ifdef __XHARBOUR__

      TRY

         oWord := TOleAuto():New( "Word.Application" )

      CATCH

         TRY

            oWord = CreateObject( "Word.Application" )

         CATCH

            MsgInfo( "xHarbour: Word is not installed on this PC. " + ;
                     "You need Excel to continue", "Ooooopppsss" )

            RETURN( .F. )

         END

      END

   #else

      TRY

         oWord := TOleAuto():New( "Word.Application" )

      CATCH

         TRY

            oWord := win_oleCreateObject( "Word.Application" )

         CATCH

            MsgInfo( "Harbour: Word is not installed on this PC. " + ;
                     "You need Excel to continue", "Ooooopppsss" )

            RETURN( .F. )

         END

      END

   #endif

   oWord:Visible := .T.
   // oWord:WindowState = 1 // Maximize

   // Creating new Doc
   odoc := oWord:Documents:Add()

   // DOC Setup
   // -----------------------------------------------------------------
   odoc:PageSetup:Orientation := ( wdOrientLandscape )
   odoc:PageSetup:PaperSize   := ( wdPaperA4 )

   // Don't know why but Word Function CentimetersToPoints cause LINKER error ?!

   /*
   VB

   Selection.Paragraphs.TabStops.Add _
   Position:=Application.CentimetersToPoints(1.5), _
   Alignment:=wdAlignTabCenter
   Este exemplo define um recuo da primeira linha de 2,5 centímetros para o primeiro parágrafo do documento ativo.

   VB

   ActiveDocument.Paragraphs(1).FirstLineIndent = _
   Application.CentimetersToPoints(2.5)
   */


   #ifdef __XHARBOUR__  // No funciona en xHarbour porque?

   // NO CAMBIA NADA SE NO USO ESTE COMANDO. Misterio...
   // odoc:PageSetup:TopMargin    := oWord:CentimetersToPoints( 2.5 )

   #else // asi, funciona en Harbour - xHarbour, no.

                                       // funciona.
      // odoc:PageSetup:TopMargin    := oWord:CentimetersToPoints( 2.5 )
                                       // No funciona en xHarbour?
      odoc:PageSetup:TopMargin      := oWord:Application:CentimetersToPoints( 2.5 )

   #endif

   odoc:PageSetup:TopMargin         := 80  // points
   odoc:PageSetup:BottomMargin      := 60
   odoc:PageSetup:LeftMargin        := 60
   odoc:PageSetup:RightMargin       := 40
   odoc:PageSetup:Gutter            := 0
   odoc:PageSetup:HeaderDistance    := 40
   odoc:PageSetup:FooterDistance    := 40
   // odoc:PageSetup:PageWidth         := 21
   // odoc:PageSetup:PageHeight        := 29.7
   odoc:PageSetup:VerticalAlignment := wdAlignVerticalTop

   // DOC Setup
   // -----------------------------------------------------------------
   // Header
   // --------------------------------------------------------------------
   odoc:ActiveWindow:ActivePane:View:SeekView := ( wdSeekCurrentPageHeader )
   odoc:Select()

   oWord:Selection:ParagraphFormat:Alignment := wdAlignParagraphCenter
   oWord:Selection:Font:Name := "Arial"
   oWord:Selection:Font:Bold := wdToggle

   //__text := win_OEMToANSI( "Order Confirmation" )
   __text := OemToAnsi( "Order Confirmation" )

   oWord:Selection:TypeText( __text )

   // Header
   // --------------------------------------------------------------------
   // Footer
   // --------------------------------------------------------------------
   odoc:ActiveWindow:ActivePane:View:SeekView := ( wdSeekCurrentPageFooter )
   odoc:Select()

   oWord:Selection:ParagraphFormat:Alignment := wdAlignParagraphLeft
   oWord:Selection:Font:Name := "Arial"
   oWord:Selection:Font:Bold := wdToggle
   oWord:Selection:Font:Size := 6

   // Order number
   //
   // __text := win_OEMToANSI( "PD 9999999.DOC" )
   __text := OemToAnsi( "PD 9999999.DOC" )

   oWord:Selection:TypeText( __text )

   // Blank Lines
   oWord:Selection:TypeParagraph()
   oWord:Selection:TypeParagraph()
   oWord:Selection:ParagraphFormat:Alignment := wdAlignParagraphCenter
   oWord:Selection:Font:Name := "Arial"
   oWord:Selection:Font:Bold := wdToggle
   oWord:Selection:Font:Size := 8

   __auto := 'AUTOTEXT "Pagina X de Y" '

   // __auto := win_OEMToANSI( __auto )
   __auto := OemToAnsi( __auto )

   oWord:Selection:Fields:Add( oWord:Selection:RANGE, - 1, __auto, .T. )

   // Footer
   // --------------------------------------------------------------------
   // Return Active Doc
   // ---------------------------------------------------------
   odoc:ActiveWindow:ActivePane:View:SeekView := ( wdSeekMainDocument )

   // First Paragraph , just to assign a range for table 1
   opr1 := odoc:Paragraphs:Add() // paragrafo 1 para Tab1
   rng1 := opr1:Range

   otb1 := odoc:Tables:Add( rng1, 3, 2 )

   // Tab1 setup
   otb1:Borders:OutsideLineStyle := wdLineStyleSingle
   otb1:Borders:InsideLineStyle := wdLineStyleNone
   otb1:Select()

   oWord:Selection:Cells:VerticalAlignment := wdCellAlignVerticalCenter

   // Tab1 rows and cols setup
   otb1:Rows:Item( 1 ):Height := 18
   otb1:Rows:Item( 2 ):Height := 12
   otb1:Rows:Item( 3 ):Height := 12
   otb1:Columns:Item( 1 ):PreferredWidth := 350
   otb1:Columns:Item( 2 ):PreferredWidth := 100

   // Size columns, for simplicity, let word do the work
   //otb1:Columns:Autofit()

   // Fill the cells
   __text := 'ACME INC. - '
   __text += 'Pedido :  9999999'

   otb1:Cell( 1, 1 ):Range:Font:Name := "Arial"
   otb1:Cell( 1, 1 ):Range:Font:Size := 10
   otb1:Cell( 1, 1 ):Range:Font:Bold := wdToggle
   otb1:Cell( 1, 1 ):Range:TEXT := __text
   otb1:Cell( 1, 1 ):Range:Select()

   oWord:Selection:MoveRight( wdCell, 1 )

   // __text := 'Data : 99/99/9999'
   __text := "Data : " + DTOC( DATE() )

   otb1:Cell( 1, 2 ):Range:Font:Name := "Arial"
   otb1:Cell( 1, 2 ):Range:Font:Size := 10
   otb1:Cell( 1, 2 ):Range:Font:Bold := wdToggle
   otb1:Cell( 1, 2 ):Range:TEXT := __text
   otb1:Cell( 1, 2 ):Range:Select()

   oWord:Selection:MoveLeft( wdCell, 1 )

   otb1:Cell( 1, 2 ):Range:Select()

   oWord:Selection:MoveLeft( wdCell, 1 )

   __text := 'Sitio Baixa do Maracuja, S/N  -  Distrito de Santa Fe'
   __text += ' - Crato-CE'
   __text += Chr( 13 ) + Chr( 10 )
   __text += 'CEP : 63.136-000'

   otb1:Cell( 2, 1 ):Range:Font:Name := "Arial"
   otb1:Cell( 2, 1 ):Range:Font:Size := 9
   otb1:Cell( 2, 1 ):Range:TEXT := __text
   otb1:Cell( 2, 1 ):Range:Select()

   oWord:Selection:MoveRight( wdCell, 1 )

   __text := 'Resp. LYC : Caio'

   otb1:Cell( 2, 2 ):Range:Font:Name := "Arial"
   otb1:Cell( 2, 2 ):Range:Font:Size := 9
   otb1:Cell( 2, 2 ):Range:Font:Bold := wdToggle
   otb1:Cell( 2, 2 ):Range:TEXT := __text
   otb1:Cell( 2, 2 ):Range:Select()

   oWord:Selection:MoveLeft( wdCell, 1 )

   __text := 'Tel. / Fax : (88) 9.9815-2920'

   otb1:Cell( 3, 1 ):Range:Font:Name := "Arial"
   otb1:Cell( 3, 1 ):Range:Font:Size := 9
   otb1:Cell( 3, 1 ):Range:TEXT := __text
   otb1:Cell( 3, 1 ):Range:Select()

   oWord:Selection:MoveRight( wdCell, 1 )

   otb1:Cell( 3, 2 ):Range:Select()

   oWord:Selection:Collapse( wdCollapseEnd )
   // Closing Tab1 range , selection

   // Blank Line
   opr2 := odoc:Paragraphs:Add() // paragrafo 2

   rng2 := opr2:Range
   rng2:Select()

   oWord:Selection:Collapse( wdCollapseEnd )

   // Client Data
   opr3 := odoc:Paragraphs:Add() // paragrafo 3 , Tab2

   rng3 := opr3:Range

   otb2 := odoc:Tables:Add( rng3, 3, 2 )
   otb2:Borders:OutsideLineStyle := wdLineStyleSingle
   otb2:Borders:InsideLineStyle := wdLineStyleNone
   otb2:Select()

   oWord:Selection:Cells:VerticalAlignment := wdCellAlignVerticalCenter

   otb2:Rows:Item( 1 ):Height := 18
   otb2:Rows:Item( 2 ):Height := 12
   otb2:Rows:Item( 3 ):Height := 12

   otb2:Columns:Item( 1 ):PreferredWidth := 50
   otb2:Columns:Item( 2 ):PreferredWidth := 400

   // Size columns, for simplicity, let word do the work
   //otb2:Columns:Autofit()

   __text := 'Cliente : '

   otb2:Cell( 1, 1 ):Range:Font:Name := "Arial"
   otb2:Cell( 1, 1 ):Range:Font:Size := 10
   otb2:Cell( 1, 1 ):Range:TEXT := __text
   otb2:Cell( 1, 1 ):Range:Select()

   oWord:Selection:MoveRight( wdCell, 1 )

   __text := 'Cecilio dos Santos Lima'

   otb2:Cell( 1, 2 ):Range:Font:Name := "Arial"
   otb2:Cell( 1, 2 ):Range:Font:Size := 10
   otb2:Cell( 1, 2 ):Range:TEXT := __text
   otb2:Cell( 1, 2 ):Range:Select()
   oWord:Selection:MoveLeft( wdCell, 1 )

   __text := ''

   otb2:Cell( 2, 1 ):Range:Font:Name := "Arial"
   otb2:Cell( 2, 1 ):Range:Font:Size := 10
   otb2:Cell( 2, 1 ):Range:TEXT := __text
   otb2:Cell( 2, 1 ):Range:Select()

   oWord:Selection:MoveRight( wdCell, 1 )

   __text := 'Sitio Baixa do Maracuja, 185 - Distrito de Santa Fe'
   __text += ' - Crato-CE'
   __text += Chr( 13 ) + Chr( 10 )
   __text += 'CEP : 63.136-000'

   otb2:Cell( 2, 2 ):Range:Font:Name := "Arial"
   otb2:Cell( 2, 2 ):Range:Font:Size := 8
   otb2:Cell( 2, 2 ):Range:TEXT := __text
   otb2:Cell( 2, 2 ):Range:Select()

   oWord:Selection:MoveLeft( wdCell, 1 )

   __text := 'Contato : '

   otb2:Cell( 3, 1 ):Range:Font:Name := "Arial"
   otb2:Cell( 3, 1 ):Range:Font:Size := 8
   otb2:Cell( 3, 1 ):Range:TEXT := __text
   otb2:Cell( 3, 1 ):Range:Select()

   oWord:Selection:MoveRight( wdCell, 1 )

   __text := 'O Proprio'

   otb2:Cell( 3, 2 ):Range:Font:Name := "Arial"
   otb2:Cell( 3, 2 ):Range:Font:Size := 8
   otb2:Cell( 3, 2 ):Range:TEXT := __text
   otb2:Cell( 3, 2 ):Range:Select()

   oWord:Selection:Collapse( wdCollapseEnd )

   // Blank Line
   opr4 := odoc:Paragraphs:Add() // paragrafo 4
   rng4 := opr4:Range
   rng4:Select()

   oWord:Selection:Collapse( wdCollapseEnd )

   // Order Table Instruction and Button
   opr5 := odoc:Paragraphs:Add() // paragrafo 5
   rng5 := opr5:Range

   otb3 := odoc:Tables:Add( rng5, 1, 2 )
   otb3:Select()

   oWord:Selection:Cells:VerticalAlignment := wdCellAlignVerticalCenter

   otb3:Borders:OutsideLineStyle := wdLineStyleNone
   otb3:Borders:InsideLineStyle  := wdLineStyleNone
   otb3:Rows:Item( 1 ):Height := 16
   otb3:Columns:Item( 1 ):PreferredWidth := 350
   otb3:Columns:Item( 2 ):PreferredWidth := 100

   // Size columns, for simplicity, let word do the work
   // otb3:Columns:Autofit()

   __mens := 'Eventuais alteracoes de quantidades poderao serem feitas na Col. "Qtde. Alt.".'
   __mens += Chr( 13 ) + Chr( 10 )
   __mens += 'Em caso de alteracoes, para atualizar Tab. Pedido basta clicar botao "Atualizar Pedido".'

   // __mens := win_OEMToANSI( __mens )
   __mens := OemToAnsi( __mens )

   otb3:Cell( 1, 1 ):Range:Font:Name := "Arial"
   otb3:Cell( 1, 1 ):Range:Font:Size := 8
   otb3:Cell( 1, 1 ):Range:Font:Bold := wdToggle
   otb3:Cell( 1, 1 ):Range:TEXT := __mens
   otb3:Cell( 1, 1 ):Range:Select()

   oWord:Selection:MoveLeft( wdCell, 1 )

   // Linha em branco
   opr6 := odoc:Paragraphs:Add() // paragrafo 6
   rng6 := opr6:Range
   rng6:Select()
   oWord:Selection:Collapse( wdCollapseEnd )

   // Order Table Header array
   vcab := {}
   AAdd( vcab, 'Codigo Mercado' )   // esquerda
   AAdd( vcab, 'Marca' )            // centro
   AAdd( vcab, 'FOB US$' )          // direita
   AAdd( vcab, 'Qtde.' )            // direita
   AAdd( vcab, 'Total US$' )        // direita
   AAdd( vcab, 'Qtde. Alt.' )       // direita
   AAdd( vcab, 'Total Alt. US$' )   // direita

   // Order Table Def.
   oprA := odoc:Paragraphs:Add() // paragrafo 10 , Tab3
   rngA := oprA:Range

   // Definicao linhas e colunas tabela
   nrow := Len( vtbl )
   ncol := Len( vcab )
   // 1 linha cab.
   //
   otb4 := odoc:Tables:Add( rngA, nrow + 1, ncol )
   otb4:Borders:OutsideLineStyle := wdLineStyleSingle
   otb4:Borders:InsideLineStyle := wdLineStyleSingle
   otb4:Select()

   oWord:Selection:Cells:VerticalAlignment := wdCellAlignVerticalCenter

   // Order Table Header
   FOR ic = 1 TO ncol

      __text := vcab[ ic ]

      otb4:Cell( 1, ic ):Range:Font:Name := "Arial"
      otb4:Cell( 1, ic ):Range:Font:Size := 9
      otb4:Cell( 1, ic ):Range:Font:Bold := wdToggle
      otb4:Cell( 1, ic ):Range:TEXT := __text
      otb4:Columns:Item( ic ):Select()

      // Size columns, for simplicity, let word do the work
      // otb4:Columns:Autofit()

      IF ic = 1

         otb4:Columns:Item( ic ):PreferredWidth := 100
         oWord:Selection:ParagraphFormat:Alignment := wdAlignParagraphLeft

      ELSEIF ic = 2

         otb4:Columns:Item( ic ):PreferredWidth := 50
         oWord:Selection:ParagraphFormat:Alignment := wdAlignParagraphCenter

      ELSE

         otb4:Columns:Item( ic ):PreferredWidth := 70
         oWord:Selection:ParagraphFormat:Alignment := wdAlignParagraphRight

      ENDIF

      oWord:Selection:Collapse( wdCollapseEnd )

   NEXT

   // Order Table
   FOR i = 1 TO nrow

      FOR j = 1 TO ncol

         otb4:Cell( i + 1, j ):Range:Font:Name := "Courier New"
         otb4:Cell( i + 1, j ):Range:Font:Size := 8

         IF j <= ncol - 2

            __text := vtbl[ i, j ]

            otb4:Cell( i + 1, j ):Range:TEXT := __text

         ELSEIF j = ncol - 1

            crng := otb4:Cell( i + 1, j ):Range

            odoc:FormFields:Add( crng, wdFieldFormTextInput )

         ELSE

            formula := "="
            formula += "C" + AllTrim( tran( i + 1, '999' ) )
            formula += "*"
            formula += "F" + AllTrim( tran( i + 1, '999' ) )

            otb4:Cell( i + 1, j ):Formula( formula, "0,00" )

         ENDIF

      NEXT

   NEXT
   //
   otb4:Cell( nrow + 1, ncol ):Range:Select()

   oWord:Selection:Collapse( wdCollapseEnd )
   oWord:ActiveDocument:Protect( wdAllowOnlyFormFields, .T., "hu" )

   odoc:SaveAS( cFileName )  // EN C:\TEMP

   // odoc:Close()           // CLOSE .DOC

   // oWord:Quit()           // QUIT WORD.exe

RETURN NIL
// Print .doc
FUNCTION Imprime_Word( cFileName )

   LOCAL oWord

   #ifdef __XHARBOUR__

      oWord := CreateObject( "Word.Application" )

   #else

      oWord := win_oleCreateObject( "Word.Application" )

   #endif

   oWord:Documents:Open( cFileName )
   oWord:WindowState := 1
   oWord:Visible := .T.

   oWord:PrintOut()          // PARA IMPRIMIR DIRETO

   oWord:Quit()

RETURN NIL

// FIN / END
 


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

Re: oWord:CentimetersToPoints() en xHarbour

Postby karinha » Sun Apr 23, 2023 1:13 pm

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

Re: oWord:CentimetersToPoints() en xHarbour

Postby Jimmy » Sun Apr 23, 2023 2:02 pm

hi,

please try this which i got from ChatGPT
Sure, here's an example of how to use the `CentimetersToPoints` method in FiveWin code with a `LOCAL` variable:

Code: Select all  Expand view
#include "FiveWin.ch"
#include "Word.ch"

FUNCTION MAIN()

   // Create a Word application object
   LOCAL oWord := WinWordObj():New()

   // Convert 2 centimeters to points
   LOCAL nPts := oWord:CentimetersToPoints(2)

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

   // Quit Word
   oWord:Quit()

RETURN

We create a Word application object `oWord` using the `New` method of the `WinWordObj` class, and call the `CentimetersToPoints` method on the `oWord` object with a value of 2 and store the result in the `nPts` variable. Finally, we use the `Str` function to convert the result to a string and display it using the `MsgInfo` function. We also call the `Quit` method on the `oWord` object to close the Word application..


p.s. it does work on my PC
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1584
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: oWord:CentimetersToPoints() en xHarbour

Postby karinha » Sun Apr 23, 2023 2:58 pm

Gracias Jimmy.

Con HARBOUR funciona mui bién.

Con xHarbour CRASH, mira imagen:

https://imgur.com/qnu4bH9

Image

Thanks.

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

Re: oWord:CentimetersToPoints() en xHarbour

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

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: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: oWord:CentimetersToPoints() en xHarbour

Postby Jimmy » Sun Apr 23, 2023 3:36 pm

hi,

instead of
Code: Select all  Expand view
oWord := WinWordObj():New()

you can use "direct"
Code: Select all  Expand view
 oWord := CreateObject("Word.Application")
  IF Empty( oWord )
    MsgBox( "Microsoft Word not installied" )
  ENDIF
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1584
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: oWord:CentimetersToPoints() en xHarbour

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

Idem Jymmy. Mismo error.

Code: Select all  Expand view

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

#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL oWord
   // Convert 2.5 centimeters to points
   LOCAL nPts

   oWord := WinWordObj():New()

   oWord := CreateObject("Word.Application")

   IF EMPTY( oWord )

      MsgInfo( "Microsoft Word not installied" )

      RETURN NIL

   ENDIF

   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: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: oWord:CentimetersToPoints() en xHarbour

Postby Jimmy » Sun Apr 23, 2023 4:26 pm

karinha wrote:I
Code: Select all  Expand view

   oWord := WinWordObj():New()

   oWord := CreateObject("Word.Application")
 

you did try to create 2 Instance :?:

use only CreateObject("Word.Application")

it work on my PC under Xbase++ and harbour but i don´t know xharbour

p.s. about which Word Version are we talking :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1584
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: oWord:CentimetersToPoints() en xHarbour

Postby karinha » Sun Apr 23, 2023 4:42 pm

Definitivamente, el ERROR está en WIN32OLE.PRG:

Code: Select all  Expand view

//---------------------------------------------------------------------------//
METHOD New( uObj, cClass, cLicense ) CLASS TOleAuto

   LOCAL oErr

   // Hack incase OLE Server already created and New() is attempted as an OLE Method.
   IF ::hObj != NIL

      RETURN HB_ExecFromArray( Self, "_New", HB_aParams() )  // CRASH aqui

   ENDIF
 


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

Re: oWord:CentimetersToPoints() en xHarbour

Postby karinha » Sun Apr 23, 2023 4:54 pm

Jimmy, on HARBOUR it works perfectly. You need to test it on XHARBOUR to understand.

Definitivamente, el ERROR está en WIN32OLE.PRG:

Code: Select all  Expand view

//---------------------------------------------------------------------------//
METHOD New( uObj, cClass, cLicense ) CLASS TOleAuto

   LOCAL oErr

   // Hack incase OLE Server already created and New() is attempted as an OLE Method.
   IF ::hObj != NIL

      RETURN HB_ExecFromArray( Self, "_New", HB_aParams() )  // CRASH aqui

   ENDIF
 


Download completo:

https://mega.nz/file/dZ8iULiA#UFbX34wH9DKROA3lQT_WS1WiA-K1jAwbuOBUr9eD8w0

Please TEST Jimmy,

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

Re: oWord:CentimetersToPoints() en xHarbour

Postby karinha » Sun Apr 23, 2023 5:20 pm

Ni usando:

Code: Select all  Expand view

   oWord := CreateObject("Word.Application.12")
 


NO Funciona. Mistério... jajajaja,

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

Re: oWord:CentimetersToPoints() en xHarbour

Postby karinha » Mon Apr 24, 2023 11:18 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: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: oWord:CentimetersToPoints() en xHarbour

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

Solo necesito averiguar qué es este error:
I just need to figure out what this error is:

ERRO! A ENTRADA DE AUTOTEXTO NÃO FOI DEFINIDA.
¡ERROR! LA ENTRADA DE AUTOTEXTO NO ESTÁ DEFINIDA.
ERROR! AUTOTEXT ENTRY IS NOT DEFINED.

Image:

https://imgur.com/7J46lj6

Image

Gracias.

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


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 70 guests