to calculate height of text as content in HPDFPRINT TO

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
jairpinho
Posts: 236
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Been thanked: 2 times
Contact:

to calculate height of text as content in HPDFPRINT TO

Post by jairpinho » Mon Oct 29, 2018 9:26 pm

I can not calculate height of text as content of variable in HPDFPRINT TO follows example of a text table where I can not fit the text of the description of the material.

Code: Select all

for nPos := 1 to Form_Novo_Orcamento.Grid_1.ItemCount  			&& pega o total de item na grid
			
		aLinha := GetProperty ( 'Form_Novo_Orcamento' , 'Grid_1' , 'ITEM' , nPos )
		cDescricao := Alltrim(aLinha [2]) + "  " + Alltrim(aLinha [3]) + "  " + Alltrim(aLinha [11]) + "  " + Alltrim(aLinha [8]) + "  Marca " + Alltrim(aLinha [7])
 		
		nCharacters := LEN(Alltrim(cDescricao))  // altrim retirar espaçoas em branco da variavel
		nLinhas := nCharacters / 60
		nResto := (nCharacters % 60) // resto da divisão por 60
		
		if nLinhas < 1
			nDesc_size :=  5
		elseif nResto != 0 .and. nLinhas > 1
			nDesc_size := (1 + int(nLinhas)) * 5
		elseif nResto == 0 .and. nLinhas > 1
			nDesc_size := nLinhas * 5
		endif
		 msgdebug(LEN(Alltrim(cDescricao)),"-",Alltrim(cDescricao) )
		  msgdebug(nCharacters)
		 msgdebug(nLinhas)
		 msgdebug(nResto)
		 msgdebug(nDesc_size)

		  
		@ F, 13 HPDFPRINT Alltrim(STR(npos))  FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA ITEM
		@ F, 25 HPDFPRINT Alltrim(aLinha [4])  FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA ITEM
        @ F, 35 HPDFPRINT cDescricao to F+nDesc_size, 150 FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA DESCRIÇÃO
		
		IF Form_Novo_Orcamento.Check_4.Value == .F.
			@ F, 155 HPDFPRINT MoedaMysql(VAL(Alltrim(aLinha [5])))  FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA DESCRIÇÃO
			@ F, 180 HPDFPRINT MoedaMysql(VAL(Alltrim(aLinha [6])))  FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA DESCRIÇÃO
			nTotal_material := nTotal_material + val(aLinha [6])
		else
			@ F, 155 HPDFPRINT Alltrim("0,00")  FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA DESCRIÇÃO
			@ F, 180 HPDFPRINT Alltrim("0,00")  FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA DESCRIÇÃO
			nTotal_material := 0
		ENDIF
 
          F:= IIF(nDesc_size > 5 , F + nDesc_size, F+5)
next

Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
dragancesu
Posts: 574
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia
Has thanked: 14 times
Been thanked: 111 times

Post by dragancesu » Mon Oct 29, 2018 10:20 pm

Maybe it's hard, maybe it's not
These are windows fonts and they are standard,
write what you want in WORD, print and measure
That is all

It's my start with hmg report

User avatar
mol
Posts: 3062
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 176 times
Been thanked: 96 times
Contact:

Post by mol » Tue Oct 30, 2018 7:11 am

Edk put some functions to calculate text length some time ago. Maybe it will help you. Try to search

Post Reply