Excel - help to print Dear friends, an excel sheet with data and now I necessity to prepare to print The required settings are: - 1 page on width - first row to title - print grid - to set the orientation if the cOriente contain "V" Portrait or "O" for Landscape. This code do not work: WITH OBJECT oExcel:ActiveWorkbook:Worksheets("Sheet1"):PageSet up() :PrintTitleRows := "$1:$1" :PrintTitleColumns := "" END // oExcel:ActiveWorkbook:Worksheets("Sheet1"):PageSet up:PrintArea := "" WITH OBJECT oExcel:ActiveWorkbook:Worksheets("Sheet1"):PageSet up() // :Orientation := IF( cOriente == "V",xlPortrait,xlLandscape ) :PrintGridlines := 1 // True :PrintHeadings := 0 // False // :Zoom := 0 // False :FitToPagesWide := 1 :FitToPagesTall := 0 // :PrintErrors := 0 // xlPrintErrorsDisplayed END PrintArea, Orientation, Zoom and PrintErrors create errors :-( Can you help me? Regards, Ugo |
Re: Excel - help to print "Ugo Garombo" <garombo@libero.it> ha scritto nel messaggio news:ee2sk.135862$FR.415485@twister1.libero.it... > Dear friends, > an excel sheet with data and now I necessity to prepare to print > The required settings are: > - 1 page on width > - first row to title > - print grid > - to set the orientation if the cOriente contain "V" Portrait or "O" for > Landscape. > > This code do not work: > WITH OBJECT oExcel:ActiveWorkbook:Worksheets("Sheet1"):PageSet up() > :PrintTitleRows := "$1:$1" > :PrintTitleColumns := "" > END > // oExcel:ActiveWorkbook:Worksheets("Sheet1"):PageSet up:PrintArea := "" > WITH OBJECT oExcel:ActiveWorkbook:Worksheets("Sheet1"):PageSet up() > // :Orientation := IF( cOriente == "V",xlPortrait,xlLandscape ) > :PrintGridlines := 1 // True > :PrintHeadings := 0 // False > // :Zoom := 0 // False > :FitToPagesWide := 1 > :FitToPagesTall := 0 > // :PrintErrors := 0 // xlPrintErrorsDisplayed > END > > PrintArea, Orientation, Zoom and PrintErrors create errors :-( > > Can you help me? Please show a reduced and self-contained sample of the problem. EMG -- EMAG Software Homepage: http://www.emagsoftware.it The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum The Best of Spectrum Games: http://www.emagsoftware.it/tbosg The EMG Music page: http://www.emagsoftware.it/emgmusic |
Re: Excel - help to print > Please show a reduced and self-contained sample of the problem. Ciao Enrico, try: #include "FiveWin.ch" PROCEDURE Main LOCAL nError IF ( nError := SetExcel() ) > 0 DO CASE CASE nError == 1 MsgStop( "Plese install excel ;-)", "Error" ) CASE nError == 2 MsgStop( "Errore durante la creazione del foglio", "Terminata elaborazione" ) CASE nError == 3 MsgStop( "Errore durante il riempimento del foglio", "Terminata elaborazione" ) CASE nError == 4 MsgStop( "Errore durante l'impostazione di stampa", "Terminata elaborazione" ) ENDCASE ELSE MsgInfo( "TUTTO OK" ) ENDIF RETURN //------------------------------------------------------------------------------ STATIC FUNCTION SetExcel() LOCAL oExcel, oSheet := {}, acName := {}, aTitle := {}, nPos := 1, anRiga := {}, i, u, nTitle := 5 FOR i := 1 TO nTitle AAdd( aTitle, "Title" + PadL( i, 3, " " ) ) NEXT // Connessione Excel TRY oExcel := CREATEOBJECT( "Excel.Application" ) CATCH RETURN 1 END // Impostazione Foglio TRY AAdd( oSheet, oExcel:WorkBooks:Add():WorkSheets(1) ) AAdd( acName, "TestExcel" ) oSheet[nPos]:Name := "TestExcel" // Aggiungo le intestazioni FOR i := 1 TO nTitle oSheet[nPos]:Cells( 1, i ):Value := aTitle[ i ] NEXT CATCH // In caso di errore... // oExcel:QUIT() oExcel:Set( "Visible", .T.) RETURN 2 END // Caricamento dati TRY // Imposto la riga di lavoro AAdd( anRiga, 1 ) FOR u = 1 TO 60 anRiga[nPos] ++ FOR i := 1 TO nTitle oSheet[ nPos ]:Cells( anRiga[ nPos ], I ):Value := "[" + Chr( 64 + HB_RandomInt( 8 ) ) + ":" + LTrim( Str( u, 0 ) ) + "]" NEXT NEXT CATCH // In caso di errore... // oExcel:QUIT() oExcel:Set( "Visible", .T. ) RETURN 3 END // Fase di impostazione per la stampa TRY WITH OBJECT oExcel:ActiveWorkbook:Worksheets(acName[nPos]):PageSetup() :PrintTitleRows := "$1:$1" :PrintTitleColumns := "" END // oExcel:ActiveWorkbook:Worksheets(acName[nPos]):PageSetup:PrintArea := "" WITH OBJECT oExcel:ActiveWorkbook:Worksheets(acName[nPos]):PageSetup() // :Orientation := IF( cOriente == "V", xlPortrait, xlLandscape ) :PrintGridlines := 1 // True :PrintHeadings := 0 // False // :Zoom := 0 // False :FitToPagesWide := 1 :FitToPagesTall := 0 // :PrintErrors := 0 // xlPrintErrorsDisplayed END CATCH // In caso di errore... // oExcel:QUIT() oExcel:Set( "Visible", .T.) RETURN 4 END oExcel:Set( "Visible", .T.) RETURN 0 The result excel file is not setting ok, the "adatta ad 1 pagina di larghezza e X [quelle che servono] in lunghezza" is not set the "righe da ripetere in alto:" is not set Regards, Ugo |
Re: Excel - help to print <garombo@gmail.com> ha scritto nel messaggio news:e1069b74-4672-4f4d-b642-b3eeb9434a4a@59g2000hsb.googlegroups.com... :FitToPagesTall := .F. EMG -- EMAG Software Homepage: http://www.emagsoftware.it The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum The Best of Spectrum Games: http://www.emagsoftware.it/tbosg The EMG Music page: http://www.emagsoftware.it/emgmusic |
Re: Excel - help to print On 27 Ago, 19:58, "Enrico Maria Giordano" <e.m.giord...@emagsoftware.it> wrote: > <garo...@gmail.com> ha scritto nel messaggionews:e1069b74-4672-4f4d-b642-b3eeb9434a4a@59g2000hsb.googlegroups.com... > > :FitToPagesTall * *:= .F. > Dear Enrico, yes, the error is not present but is not set the option "adatta ad 1 pagina di larghezza ..." Test with nTitle = 15 and FOR u = 1 TO 120 Thank you Regards, Ugo |
Re: Excel - help to print <garombo@gmail.com> ha scritto nel messaggio news:e34b3a61-b42a-484b-a102-11668c311402@w7g2000hsa.googlegroups.com... > Dear Enrico, > yes, the error is not present but is not set the option > "adatta ad 1 pagina di larghezza ..." > > Test with > nTitle = 15 > and > FOR u = 1 TO 120 Sorry, I don't understand what do you want to get. EMG -- EMAG Software Homepage: http://www.emagsoftware.it The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum The Best of Spectrum Games: http://www.emagsoftware.it/tbosg The EMG Music page: http://www.emagsoftware.it/emgmusic |
Re: Excel - help to print On 28 Ago, 10:37, "Enrico Maria Giordano" <e.m.giord...@emagsoftware.it> wrote: > <garo...@gmail.com> ha scritto nel messaggionews:e34b3a61-b42a-484b-a102-11668c311402@w7g2000hsa.googlegroups.com... > > > Dear Enrico, > > yes, the error is not present but is not set the option > > "adatta ad 1 pagina di larghezza ..." > > > Test with > > * * *nTitle = 15 > > and > > * * * FOR u = 1 TO 120 > > Sorry, I don't understand what do you want to get. > > EMG > > -- > EMAG Software Homepage: * *http://www.emagsoftware.it > The EMG's ZX-Spectrum Page:http://www.emagsoftware.it/spectrum > The Best of Spectrum Games:http://www.emagsoftware.it/tbosg > The EMG Music page: * * * *http://www.emagsoftware.it/emgmusic Dear Enrico, replace in my code: nTitle = 15 and after // Caricamento dati FOR u = 1 TO 120 Compile and run, you get an xls, go in preview, is set "Imposta al 100%" but i have got necessity to set "Adatta a 1 pagina ..." I hope that I explained Regards, Ugo |
Re: Excel - help to print <garombo@gmail.com> ha scritto nel messaggio news:a283c0dc-c435-4ff2-acf8-40e62529ad85@l42g2000hsc.googlegroups.com... > Dear Enrico, > > replace in my code: > nTitle = 15 > and after // Caricamento dati > FOR u = 1 TO 120 > > Compile and run, you get an xls, > go in preview, is set "Imposta al 100%" > but i have got necessity to set > "Adatta a 1 pagina ..." :Zoom := .F. // False EMG -- EMAG Software Homepage: http://www.emagsoftware.it The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum The Best of Spectrum Games: http://www.emagsoftware.it/tbosg The EMG Music page: http://www.emagsoftware.it/emgmusic |
Re: Excel - help to print > :Zoom * * * * * * *:= .F. // False Dear Enrico, yesssssss, now work well! :-) Thank you. Regards, Ugo |
| All times are GMT -5. The time now is 09:14 PM. |
Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0