Centrar texto VERTICALMENTE
Centrar texto VERTICALMENTE
Hola a todos,
Tengo que centrar un texto verticalmente. Está escrito en el eje de las 'y', en vertical, el FONT que utilizo está definido así:
DEFINE FONT oFnt_Arial6V NAME "Arial" SIZE 0,-6 OF ::oPrn NESCAPEMENT 900
PRINTER contempla centrar horizontalmente respecto del eje 'x', pero en vertical respecto del eje 'y' no lo veo.
¿Cómo lo harían Ustedes?
A ver que se les ocurre.
Muchas gracias
Tengo que centrar un texto verticalmente. Está escrito en el eje de las 'y', en vertical, el FONT que utilizo está definido así:
DEFINE FONT oFnt_Arial6V NAME "Arial" SIZE 0,-6 OF ::oPrn NESCAPEMENT 900
PRINTER contempla centrar horizontalmente respecto del eje 'x', pero en vertical respecto del eje 'y' no lo veo.
¿Cómo lo harían Ustedes?
A ver que se les ocurre.
Muchas gracias
Un Saludo
Carlos G.
FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
Carlos G.
FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Centrar texto VERTICALMENTE
Please try this sample program
Code: Select all | Expand
#include "fivewin.ch"
function Main()
local oPrn, oFont
PRINT oPrn PREVIEW
DEFINE FONT oFont NAME "Arial" SIZE 0,-60 NESCAPEMENT 900 OF oPrn
PAGE
oPrn:Box( 1, 1, 9, 4, 1, nil, nil, "INCHES" )
@ 1,1 PRINT TO oPrn TEXT "VTEXT" SIZE 3,8 INCHES ALIGN "" FONT oFont
ENDPAGE
ENDPRINT
RELEASE FONT oFont
return nil
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Centrar texto VERTICALMENTE
[quote="nageswaragunupudi"]Please try this sample program
Thank you very much mr. Nages
But that's not how it works:
PRINT oPrn FILE "C:\Temp\lerele.pdf"
I don't use HaruPDF.
Thank you very much anyway.
Code: Select all | Expand
#include "fivewin.ch"
function Main()
local oPrn, oFont
PRINT oPrn PREVIEW
DEFINE FONT oFont NAME "Arial" SIZE 0,-60 NESCAPEMENT 900 OF oPrn
PAGE
oPrn:Box( 1, 1, 9, 4, 1, nil, nil, "INCHES" )
@ 1,1 PRINT TO oPrn TEXT "VTEXT" SIZE 3,8 INCHES ALIGN "" FONT oFont
ENDPAGE
ENDPRINT
RELEASE FONT oFont
return nil
But that's not how it works:
PRINT oPrn FILE "C:\Temp\lerele.pdf"
I don't use HaruPDF.
Thank you very much anyway.
Un Saludo
Carlos G.
FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
Carlos G.
FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
Re: Centrar texto VERTICALMENTE
Mr. Nages,
I use the class TImprime and TUtilprn (provided years ago by Rafa Carmona ).
At the moment this is how it works for me (more or less):
ndummyaltura := ( ::oPrn:CmVertPhySize() / 2 ) + ( ::oPrn:CmtrGetTextWidth( AllTrim( ::oTDbfDatAmp:REGMER ), ::oFnt_Arial6V ) / 2 )
UTILPRN ::oUtil ndummyaltura, 0.5 ;
SAY AllTrim(::oTDbfDatAmp:REGMER) FONT ::oFnt_Arial6V COLOR CLR_BLACK
I want to center the text at half height of the page.
Note: New Method for de Printer.PRG
METHOD CmtrTextToVCenter( cText, oFont ) INLINE ;
( ::CmVertPhySize() / 2 ) + ::CmtrGetTextWidth( cText, oFont ) / 2
Thank you again,
I use the class TImprime and TUtilprn (provided years ago by Rafa Carmona ).
At the moment this is how it works for me (more or less):
ndummyaltura := ( ::oPrn:CmVertPhySize() / 2 ) + ( ::oPrn:CmtrGetTextWidth( AllTrim( ::oTDbfDatAmp:REGMER ), ::oFnt_Arial6V ) / 2 )
UTILPRN ::oUtil ndummyaltura, 0.5 ;
SAY AllTrim(::oTDbfDatAmp:REGMER) FONT ::oFnt_Arial6V COLOR CLR_BLACK
I want to center the text at half height of the page.
Note: New Method for de Printer.PRG
METHOD CmtrTextToVCenter( cText, oFont ) INLINE ;
( ::CmVertPhySize() / 2 ) + ::CmtrGetTextWidth( cText, oFont ) / 2
Thank you again,
Un Saludo
Carlos G.
FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
Carlos G.
FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Centrar texto VERTICALMENTE
Please try this way
and let us know
Code: Select all | Expand
#include "fivewin.ch"
function Main()
local oPrn, oFont
local cPdf := "lerele.pdf" // your pdf file name
TPrinter():lUseFWPDF := .t.
PRINT oPrn FILE cPdf PREVIEW // PREVIEW is optional. You can ommit PREVIEW
DEFINE FONT oFont NAME "Arial" SIZE 0,-60 NESCAPEMENT 900 OF oPrn
PAGE
oPrn:Box( 1, 1, 9, 4, 1, nil, nil, "INCHES" )
@ 1,1 PRINT TO oPrn TEXT "VTEXT" SIZE 3,8 INCHES ALIGN "" FONT oFont
ENDPAGE
ENDPRINT
RELEASE FONT oFont
TPrinter():lUseFWPDF := .f.
return nil
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Centrar texto VERTICALMENTE
Mira se ayuda:
Regards, saludos.
Code: Select all | Expand
// C:\FWH\SAMPLES\IMPTXT3.PRG
#Include "FiveWin.ch"
FUNCTION Main()
LOCAL WNOMBREARQPDF
IF FILE( "C:\TEMP\ARCHIVO.PDF" )
ERASE( "C:\TEMP\ARCHIVO.PDF" )
ENDIF
MsgRun( "GENERANDO ARCHIVO *.PDF...", ;
"Por Favor, Aguarde... ", ;
{ || WinExec( Generar_PDF() ), 3 } )
// Perfect, mister Nages, Thank You
IF FILE( "C:\TEMP\ARCHIVO.PDF" )
WNOMBREARQPDF := "C:\TEMP\archivo.pdf"
// ShellExecute( 0, "Print", WNOMBREARQPDF,,, 3 ) // Impresora
ShellExecute( 0, "OPEN", WNOMBREARQPDF ) // Acrobat
ENDIF
RETURN NIL
FUNCTION Generar_PDF()
LOCAL cText := MEMOREAD( "C:\TEMP\arq.txt" )
LOCAL oPrn, oFont, oFontV, nLinha, nPage := 1
nLinha := 0
PRINT oPrn FILE "C:\TEMP\archivo.pdf" // em silencio sem preview
DEFINE FONT oFont NAME "COURIER NEW" SIZE 0,-10 OF oPrn
DEFINE FONT oFontV NAME "COURIER NEW" SIZE 0,-80 NESCAPEMENT 900 OF oPrn
WHILE .NOT. EMPTY( cText )
SYSREFRESH()
CURSORWAIT()
PAGE
@ nLinha-10, 00 PRINT TO oPrn TEXT "FIVEWIN" SIZE 3,8 INCHES ALIGN "" FONT oFontV
@ nLinha, 1 PRINT TO oPrn TEXT @cText SIZE 7,10 INCHES FONT oFont
IF nLinha >= 23
ENDPAGE
nPage := nPage + 1 // Number pages
PAGE
ENDIF
ENDPAGE
nLinha := nLinha + 1
ENDDO
ENDPRINT
RELEASE FONT oFont
RELEASE FONT oFontV
CURSORARROW()
RETURN NIL
// FIN / END
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Centrar texto VERTICALMENTE
I can only comment on FWH classes.FiveWiDi wrote:Mr. Nages,
I use the class TImprime and TUtilprn (provided years ago by Rafa Carmona ).
At the moment this is how it works for me (more or less):
ndummyaltura := ( ::oPrn:CmVertPhySize() / 2 ) + ( ::oPrn:CmtrGetTextWidth( AllTrim( ::oTDbfDatAmp:REGMER ), ::oFnt_Arial6V ) / 2 )
UTILPRN ::oUtil ndummyaltura, 0.5 ;
SAY AllTrim(::oTDbfDatAmp:REGMER) FONT ::oFnt_Arial6V COLOR CLR_BLACK
I want to center the text at half height of the page.
Note: New Method for de Printer.PRG
METHOD CmtrTextToVCenter( cText, oFont ) INLINE ;
( ::CmVertPhySize() / 2 ) + ::CmtrGetTextWidth( cText, oFont ) / 2
Thank you again,
What all you want to do, I am sure we can do with FWH classes in a far simpler way.
To print text vertically and horizontally centered on the page. No calculations required. The command is very simple:
Code: Select all | Expand
@ 0, 0 PRINT TO oPrn TEXT "Single/MultiLine Text" ALIGN "" FONT oFont
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Centrar texto VERTICALMENTE
Mr. Karinha
You are missing the real point.
If you execute the program on a computer where MSWord is installed, you can not see the vertical text in the PDF.
You see the vertical text in PDF if (1) MS Word is not installed or (2) we set TPrinter():lUseFWPDF := .t.
Your example is longer but the same as my original sample as far as vertical oriented text is concerned,Mira se ayuda:
You are missing the real point.
If you execute the program on a computer where MSWord is installed, you can not see the vertical text in the PDF.
You see the vertical text in PDF if (1) MS Word is not installed or (2) we set TPrinter():lUseFWPDF := .t.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Centrar texto VERTICALMENTE
Ok. Thanks for the information Master Nages. I did not know that.nageswaragunupudi wrote:Mr. Karinha
Your example is longer but the same as my original sample as far as vertical oriented text is concerned,Mira se ayuda:
You are missing the real point.
If you execute the program on a computer where MSWord is installed, you can not see the vertical text in the PDF.
You see the vertical text in PDF if (1) MS Word is not installed or (2) we set TPrinter():lUseFWPDF := .t.
Ok, gracias por la información Maestro Nages. No sabia de eso.
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Centrar texto VERTICALMENTE
Please try these samples in the samples folder:
print01.prg
print02.prg
pdfharu1.prg
pdfharu2.prg
You can see how to generate pdfs using Word, FWH own pdf, HaruPDF, Image2pdf
Please see how simplest and one line code to print complex outputs.
And advise us what more you want us to provide
print01.prg
print02.prg
pdfharu1.prg
pdfharu2.prg
You can see how to generate pdfs using Word, FWH own pdf, HaruPDF, Image2pdf
Please see how simplest and one line code to print complex outputs.
And advise us what more you want us to provide
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Centrar texto VERTICALMENTE
Yes mr. Nages, now it works.nageswaragunupudi wrote:Please try this wayand let us knowCode: Select all | Expand
#include "fivewin.ch" function Main() local oPrn, oFont local cPdf := "lerele.pdf" // your pdf file name TPrinter():lUseFWPDF := .t. PRINT oPrn FILE cPdf PREVIEW // PREVIEW is optional. You can ommit PREVIEW DEFINE FONT oFont NAME "Arial" SIZE 0,-60 NESCAPEMENT 900 OF oPrn PAGE oPrn:Box( 1, 1, 9, 4, 1, nil, nil, "INCHES" ) @ 1,1 PRINT TO oPrn TEXT "VTEXT" SIZE 3,8 INCHES ALIGN "" FONT oFont ENDPAGE ENDPRINT RELEASE FONT oFont TPrinter():lUseFWPDF := .f. return nil
But de quality of the typography in the PDF is not good.
I guess the best solution must be to use HaruPDF.
For now i have what i wanted, i will leave this matter for later.
Thank you so much
Un Saludo
Carlos G.
FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
Carlos G.
FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Centrar texto VERTICALMENTE
Yes. Also PDF file size is large.But de quality of the typography in the PDF is not good.
Yes. Simple and smaller pdf file sizes.I guess the best solution must be to use HaruPDF.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Centrar texto VERTICALMENTE
Using PRINT oPrn FILE <pdffile>, there are 3 ways to generate PDFs.
1. Using Microsoft Word, if installed on the PC.
This is the default.
Printer class generates emf files and embeds them into Word document and saves as PDF.
pros: Good quality and medium size pdfs
cons: (1) Does not support rotated text and (2) pdf document is an image and not editable.
2. Using FWH's own PDF generator.(written many years ago)
If MSWord is not installed, this is the default.
We can also force this by setting TPrinter():lUseFWPDF := .t.
cons: (1) Lesser quality (2) Large size and (3) pdf is not editable.
3. Using HaruPDF, by setting TPrinter():lUseHaruPDF := .t.
pros: (1) Smaller size. (2) Good Quality (3) pdfs are editable.
cons: (1) Does not support Unicode fonts. (Concern only for East/Middle Asian languages)
(2) Does not support Hallow Text with image brush.
1. Using Microsoft Word, if installed on the PC.
This is the default.
Printer class generates emf files and embeds them into Word document and saves as PDF.
pros: Good quality and medium size pdfs
cons: (1) Does not support rotated text and (2) pdf document is an image and not editable.
2. Using FWH's own PDF generator.(written many years ago)
If MSWord is not installed, this is the default.
We can also force this by setting TPrinter():lUseFWPDF := .t.
cons: (1) Lesser quality (2) Large size and (3) pdf is not editable.
3. Using HaruPDF, by setting TPrinter():lUseHaruPDF := .t.
pros: (1) Smaller size. (2) Good Quality (3) pdfs are editable.
cons: (1) Does not support Unicode fonts. (Concern only for East/Middle Asian languages)
(2) Does not support Hallow Text with image brush.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India