bug FW 13.01 oReport:ToExcel()

bug FW 13.01 oReport:ToExcel()

Postby lucasdebeltran » Tue Feb 05, 2013 3:24 pm

Hi,

This sample gives this error:
Code: Select all  Expand view
#include "FiveWin.ch"
#include "report.ch"
#include "inkey.ch"
#include "xbrowse.ch"





Function main()


     USE CUSTOMER NEW ALIAS "TEST"
     msgalert("Once the Preview opens, press F2 to test")

     dbgotop()



     test_report()


     DbCloseAll()

     QUIT

return nil






function test_report()



     LOCAL oFont1, oFont2
     LOCAL oReport








     DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10
     DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-10 BOLD





     SetKey(VK_F2, { || oReport:ToExcel() })
 







     REPORT oReport TITLE  "*** Mi Primer Reporte con tílde ***"  ;
          FONT oFont1, oFont2 ;
          PREVIEW CAPTION "Mensaje del título - press F2 to export to Excel"




     oReport:bInit := { || dbGoTop()  }




     COLUMN TITLE "St"         DATA Test->State

     COLUMN TITLE "Nombre", "Apellido" ;
            DATA  Test->First, Test->Last

     COLUMN TITLE "Dirección", "Población Ciudad"  ;
            DATA  Test->Street, Test->City, ""

     COLUMN TITLE "   Salario"  ;
            DATA  Test->Salary ;
            TOTAL              ;
            RIGHT              ;
            PICTURE "9,999,999";
            FONT 2             ;
            SIZE 9



     END REPORT




     ACTIVATE REPORT oReport


     CLOSE TEST

     oFont1:End()
     oFont2:End()



RETURN NIL
//----------------------------------------------------------------------------//




 



run in fwh\samples directory please.


The error:


Code: Select all  Expand view
Application
===========
   Path and name: C:\FWH\samples\errorfivewin.exe (32 bits)
   Size: 2,497,536 bytes
   Compiler version: Harbour 3.2.0dev (Rev. 18449)
   FiveWin  Version: FWH 13.01
   Windows version: 6.1, Build 7601 Service Pack 1

   Time from start: 0 hours 0 mins 13 secs
   Error occurred at: 02/05/13, 16:21:54
   Error description: (DOS Error -2147352567) WINOLE/1006   (0x800A03EC): _FORMULA
   Args:
     [   1] = C   =SUBTOTAL( 9, D5:D1504)

Stack Calls
===========
   Called from:  => TOLEAUTO:_FORMULA( 0 )
   Called from: .\source\classes\REPORT.PRG => TREPORT:TOEXCEL( 2312 )
   Called from: errorfivewin.prg => (b)TEST_REPORT( 55 )
   Called from: .\source\classes\WINDOW.PRG => TWINDOW:KEYDOWN( 2620 )
   Called from: .\source\classes\CONTROL.PRG => TMETAFILE:KEYDOWN( 1043 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\CONTROL.PRG => TMETAFILE:HANDLEEVENT( 1724 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3177 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 990 )
   Called from: .\source\classes\RPREVIEW.PRG => TPREVIEW:ACTIVATE( 163 )
   Called from: .\source\classes\RPREVIEW.PRG => RPREVIEW( 1639 )
   Called from: .\source\classes\REPORT.PRG => (b)TREPORT_NEW( 187 )
   Called from: .\source\classes\REPORT.PRG => TREPORT:ACTIVATE( 882 )
   Called from: errorfivewin.prg => TEST_REPORT( 100 )
   Called from: errorfivewin.prg => MAIN( 20 )
 




I reported several months ago.


Thanks.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: bug FW 13.01 oReport:ToExcel()

Postby nageswaragunupudi » Tue Feb 05, 2013 8:18 pm

[ 1] = C =SUBTOTAL( 9, D5:D1504)

At the moment, ToExcel method of report class supports Excel with English installation only.
The above line needs to modified to suit other language installations.

We shall implement multi-language capability by next release.
Regards

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

Re: bug FW 13.01 oReport:ToExcel()

Postby lucasdebeltran » Wed Feb 13, 2013 11:34 am

Mr. Rao,

Great, thank you very much.

I am willing the update.

Kind regards,
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: bug FW 13.01 oReport:ToExcel()

Postby nnicanor » Thu Feb 14, 2013 2:57 am

You must have installed proper office version corresponding to your system language.


Regards,
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
nnicanor
 
Posts: 302
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: bug FW 13.01 oReport:ToExcel()

Postby lucasdebeltran » Thu Feb 14, 2013 11:00 am

Nicanor,

The problem is that oReport:ToExcel() only supports English but Mr. Rao is going to provide support for other languages, in my case Spanish.


Mr. Rao, if you could provide me a test I would be glad to test it with Excel 2003, 2007 and 2010 in Spanish before Antonio releases FWH 13.02.


Thank you very much.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: bug FW 13.01 oReport:ToExcel()

Postby nageswaragunupudi » Wed Feb 20, 2013 11:29 am

Mr. Lucasdebeltran

I am listing here names of some functions that work in English installation of Excel. As an example, I am using range address A1:A9

=SUM( A1:A9 )
=SUBTOTAL( 9, A1:A9 )
=MAX( A1:A9 )
=MIN( A1:A9 )
=COUNT( A1:A9 )
=AVERAGE( A1:A9 )
=STDEV( A1:A9 )
=STDEVP( A1:A9 )

Can you please post a corresponding list with full syntax ( like above ) in Spanish for Spanish installation of Excel? Please post after entering the formulas manually in Excel sheet and testing.
Regards

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

Re: bug FW 13.01 oReport:ToExcel()

Postby lucasdebeltran » Wed Feb 20, 2013 3:27 pm

Sure, here is it:

Please, note A1;


SUMA(A1;A2)
SUBTOTALES(A1;A2)
MAX(A1;A2)
MIN(A1;A2)
CONTAR(A1;A2)
PROMEDIO(A1;A2)
DESVEST(A1;A2)
DESVESTP(A1;A2)



Also, if you need more:
http://www.piuha.fi/excel-function-name ... anish.html


Thank you.


When you have a sample test I would be glad to run it.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: bug FW 13.01 oReport:ToExcel()

Postby nageswaragunupudi » Wed Feb 20, 2013 4:20 pm

Thanks for the information and particularly the link. This is very useful.
Wish I get this information from other users for other languages German, Portugese, Italian, etc.

I noticed the difference in the address convetion. For english, it is like A1:A2, where as for Spanish it is A1;A2. But what I am surprised is that the range address is generated by Excel's method oRange:Address(...), and I expected the method to respect the installed language's covention.

Also SUBTOTALES has two parameters. SUBTOTALES( 9, A1;A2 )

I shall be glad if you can enter this formula manually in an excel sheet and check.

Can you please check the two modifications I propose below and report the results?

TEST-1
Please locate these lines in the METHOD ToExcel() in the Report.prg
Code: Select all  Expand view
                       if oCol:lTotal
                           cAdr  := oSheet:Range( oSheet:Cells( aGrpRow[ nGrp ], nCol ), ;
                                                  oSheet:Cells( nLastRow, nCol ) ):Address( .f., .f. )
                           oSheet:Cells( nRow, nCol ):Formula := "=SUBTOTAL(9," + cAdr + ")"
                           nFont := Eval( oCol:bTotalFont )
                           if nFont != aFont[ nCol ]
                              ::xlSetFont( oSheet:Cells( nRow, nCol ), ::aFont[ nFont ] )
                           endif
                        endif
 

Please change
Code: Select all  Expand view
oSheet:Cells( nRow, nCol ):Formula := "=SUBTOTAL(9," + cAdr + ")"

as
Code: Select all  Expand view
oSheet:Cells( nRow, nCol ):FormulaLocal := "=SUBTOTAL(9," + cAdr + ")"

and let me know if the change works for you.

Please also do the second test
TEST-2
For the above lines, substitute these lines
Code: Select all  Expand view
                       if oCol:lTotal
                           cAdr  := oSheet:Range( oSheet:Cells( aGrpRow[ nGrp ], nCol ), ;
                                                  oSheet:Cells( nLastRow, nCol ) ):Address( .f., .f. )
                           cAdr  := StrTran( cAdr, ":", ";" )
                           oSheet:Cells( nRow, nCol ):Formula := "=SUBTOTALES(9," + cAdr + ")"
                           nFont := Eval( oCol:bTotalFont )
                           if nFont != aFont[ nCol ]
                              ::xlSetFont( oSheet:Cells( nRow, nCol ), ::aFont[ nFont ] )
                           endif
                        endif
 

If this works please check changing Formula as FormulaLocal also.

Awaiting your feedback.
Regards

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

Re: bug FW 13.01 oReport:ToExcel()

Postby lucasdebeltran » Wed Feb 20, 2013 5:59 pm

Mr. Rao,

Thanks for your help.

Sorry, none worked.

This is how I fixed it for spanish:

Code: Select all  Expand view
METHOD ToExcel( bProgress ) CLASS TReport

#define  xlCellTypeLastCell   11
#define  xlThin            2
#define  xlSolid           1
#define  xlCenter          -4108
#define  xlBottom          -4107
#define  xlTop             -4160
#define  xlRight           -4152
#define  xlLeft            -4131
#define  xlNone            -4142
#define  xlContinuous      1
#define  xlAutomatic       -4105
#define  xlExpression      2
#define  xlEdgeBottom      9
#define  xlEdgeTop         8
#define  xlEdgeLeft        7
#define  xlEdgeRight       10
#define  xlHairLine        1
#define  xlThick           4
#define  xlMedium          -4138
#define  xlUnderlineStyleSingle  2

   local oExcel, oBook, oSheet, oRange
   local nRow, nFirstRow, nLastRow
   local nCols, nCol, nLines, nLine, oCol, cPic, cAdr, nFont, aFont
   local aValues //, aMemos := {}, aPics := {}
   local lTotal   := .f., lMemo := .t.
   local nRowHeight, nMemoHeight
   local nMergeCols
   local lGroup, nGroups, aGrpVal, aGrpFtr, aGrpRow, nGrp, cGrp, oRng
   local nDataRows   := 0



   // FIX para forzar el DbGoTop() sin tocar los prgs
   if ::bSkip = Nil
      dbgotop()
   endif




   oExcel   := ExcelObj()
   if oExcel == nil
      MsgAlert( "Excel not installed" )
      return self
   endif
   oBook    := oExcel:WorkBooks:Add()
   oSheet   := oBook:ActiveSheet

   nCols    := Len( ::aColumns )
   nMergeCols  := nCols          // columns that can be merged for group headings
   oRange   := oSheet:Range( oSheet:Columns( 1 ), oSheet:Columns( nCols ) )

   DEFAULT ::bFor := { || .t. }, ::bWhile := { || ! eof() }

   ::Init()

   ::xlSetFont( oSheet:Cells, ::aFont[ 1 ] )
   oSheet:Cells:VerticalAlignment := xlTop
   nRowHeight := oSheet:Rows( 1 ):RowHeight

   ::xlHeader( oSheet:PageSetup )
   ::xlFooter( oSheet:PageSetup )

   aValues  := Array( nCols )
   aFont    := Array( nCols )
   lGroup   := ( nGroups := Len( ::aGroups ) ) > 0
   if lGroup
      aGrpVal        := Array( nGroups )
      aGrpFtr        := Array( nGroups )
      aGrpRow        := Array( nGroups )
   endif

   for nCol := 1 to nCols
      oCol  := ::aColumns[ nCol ]
      aFont[ nCol ]  := Eval( oCol:bDataFont )
      if aFont[ nCol ] > 1
         ::xlSetFont( oSheet:Columns[ nCol ], ::aFont[ aFont[ nCol ] ] )
      endif
      if oCol:lMemo .or. oCol:lImage
         oSheet:Columns( nCol ):ColumnWidth  := If( Empty( oCol:nSize ), 20, oCol:nSize )
      endif
      if oCol:lMemo
         oSheet:Columns( nCol ):WrapText     := .t.
         lMemo       := .t.
      endif
   next

   // Column Headers
   nRow     := Len( ::oTitle:aLine ) + 1
   nLines   := 1
   AEval( ::aColumns, { |o| nLines := Max( nLines, Len( o:aTitle ) ) } )
   WITH OBJECT oRange:Rows( nRow ):Borders( xlEdgeTop )
      :LineStyle        := xlContinuous   // 1
      :Weight           := xlMedium
   END
   for nLine := 1 to nLines
      for nCol := 1 to nCols
         oCol  := ::aColumns[ nCol ]
         if Len( oCol:aTitle ) >= nLine
            aValues[ nCol ]   := Eval( oCol:aTitle[ nLine ] )
         else
            aValues[ nCol ]   := nil
         endif
         if ( nFont := Eval( oCol:bTitleFont ) ) != aFont[ nCol ]
            ::xlSetFont( oRange:Cells( nRow, nCol ), ::aFont[ nFont ] )
         endif
      next nCol
      oRange:Rows( nRow ):Value := aValues
      nRow++
   next nLine
   WITH OBJECT oRange:Rows( nRow - 1 ):Borders( xlEdgeBottom )
      :LineStyle        := xlContinuous   // 1
      :Weight           := xlThin
   END
   nRow++
   cAdr  := oSheet:Range( oSheet:Rows( 1 ), oSheet:Rows( nRow ) ):Address
   oSheet:PageSetUp:PrintTitleRows  := cAdr

   // Column formats
   for nCol := 1 to nCols
      oCol     := ::aColumns[ nCol ]
      cPic     := oCol:aPicture[ 1 ]

      WITH OBJECT oRange:Columns( nCol )

         :HorizontalAlignment := If( oCol:nPad == RPT_CENTER, -4108, If( oCol:nPad == RPT_RIGHT, -4152, -4131 ) )
         SWITCH ValType( Eval( oCol:aData[ 1 ] ) )
         case 'C'
            oRange:Columns( nCol ):NumberFormat := "@"
            exit
         case 'N'
            :NumberFormat     := "##0"
            :HorizontalAlignment := xlRight
            if "." $ cPic
               :NumberFormat  += SubStr( cPic, At( ".", cPic ) )
            endif
            if "," $ cPic
               :NumberFormat  := "#," + :NumberFormat
            endif
            exit
         case 'D'
            :HorizontalAlignment := xlRight
         END

      END
   next

   nLines   := 1
   AEval( ::aColumns, { |o,i| nLines := Max( nLines, Len( o:aData ) ), ;
                           If( o:lTotal, ( lTotal := .t., If( nMergeCols >= i, ;
                                    nMergeCols := i - 1, nil ) ), nil ) } )

   // Main Data
   nFirstRow   := nRow
   nLastRow    := nRow - 1
   do while Eval( ::bWhile )
      if Eval( ::bFor )

         // Handle Groups
         if lGroup
            nLastRow    := nRow - 1
            // check ending of groups
            for nGrp := nGroups to 1 step -1
               cGrp  := Eval( ::aGroups[ nGrp ]:bGroup )
               if cGrp != aGrpVal[ nGrp ]
                  if aGrpVal[ nGrp ] != nil
                     WITH OBJECT ( oRng := oSheet:Range( oRange:Cells( nRow, 1 ), oRange:Cells( nRow, nMergeCols ) ) )
                        :MergeCells       := .t.
                        :Value            := aGrpFtr[ nGrp ]
                        if nGrp > 1
                           :InsertIndent( nGrp - 1 )
                        endif
                     END
                     nFont    := Eval( ::aGroups[ nGrp ]:bFootFont )
                     if nFont != aFont[ 1 ]
                        ::xlSetFont( oRng, ::aFont[ nFont ] )
                     endif
                     for nCol := 1 to nCols
                        oCol  := ::aColumns[ nCol ]
                        if oCol:lTotal
                           cAdr  := oSheet:Range( oSheet:Cells( aGrpRow[ nGrp ], nCol ), ;
                                                  oSheet:Cells( nLastRow, nCol ) ):Address( .f., .f. )
                           oSheet:Cells( nRow, nCol ):Formula := "=SUBTOTALES(9;" + cAdr + ")"
                           nFont := Eval( oCol:bTotalFont )
                           if nFont != aFont[ nCol ]
                              ::xlSetFont( oSheet:Cells( nRow, nCol ), ::aFont[ nFont ] )
                           endif
                        endif
                     next nCol
                     nRow++
                  endif // if aGrpVal[ nGrp ] != nil
                  aGrpRow[ nGrp ]   := nil  // this group ended
                  aGrpVal[ nGrp ]   := cGrp  // retain the new value
               endif // change in group value
            next nGrp
            // check start of groups
            for nGrp := 1 to nGroups
               if aGrpRow[ nGrp ] == nil // start this group
                  WITH OBJECT ( oRng := oSheet:Range( oRange:Cells( nRow, 1 ), oRange:Cells( nRow, nMergeCols ) ) )
                     :MergeCells       := .t.
                     :Value            := Eval( ::aGroups[ nGrp ]:bHeader )
                     if nGrp > 1
                        :InsertIndent( nGrp - 1 )
                     endif
                  END
                  nFont    := Eval( ::aGroups[ nGrp ]:bHeadFont )
                  if nFont != aFont[ 1 ]
                     ::xlSetFont( oRng, ::aFont[ nFont ] )
                  endif
                  nRow++
               endif
            next nGrp
            for nGrp := 1 to nGroups
               if aGrpRow[ nGrp ] == nil
                  aGrpRow[ nGrp ]   := nRow  // memorize the start row of group
               endif
            next

         endif // if lGroup

         // normal data
         for nLine := 1 to nLines
            for nCol := 1 to nCols
               oCol  := ::aColumns[ nCol ]
               if Len( oCol:aData ) >= nLine .and. !oCol:lImage
                  aValues[ nCol ]   := Eval( oCol:aData[ nLine ] )
                  if ValType( aValues[ nCol ] ) == 'C'
                     aValues[ nCol ]   := Trim( aValues[ nCol ] )
                  endif
               else
                  aValues[ nCol ]   := nil
               endif
               if ( nFont := Eval( oCol:bDataFont ) ) != aFont[ nCol ]
                  ::xlSetFont( oRange:Cells( nRow, nCol ), ::aFont[ nFont ] )
               endif
            next
            oRange:Rows( nRow ):Value  := aValues
            // Handle Memo Height in multi-line report
            if lMemo .and. nLines > 1
               if nLine == 1
                  nMemoHeight    := oSheet:Rows( nRow ):RowHeight
                  oSheet:Rows( nRow ):RowHeight := nRowHeight
               endif
               if nLine == nLines
                  for nCol := 1 to nCols
                     if ::aColumns[ nCol ]:lMemo
                        oSheet:Range( oSheet:Cells( nRow - nLines + 1, nCol ), ;
                                      oSheet:Cells( nRow, nCol ) ):MergeCells := .t.
                        if nMemoHeight > nLines * nRowHeight
                           oSheet:Rows( nRow ):RowHeight := nMemoHeight - ( nLines - 1 ) * nRowHeight
                        endif
                     endif
                  next
               endif
            endif
            nRow++
         next
      endif
      // group footers
      if lGroup
         for nGrp := 1 to nGroups
            aGrpFtr[ nGrp ]   := Eval( ::aGroups[ nGrp ]:bFooter )
         next
      endif
      ::Skip( 1 )
      nDataRows++
      if bProgress != nil .and. nDataRows % 100 == 0
         Eval( bProgress, nDataRows, Self )
         SysRefresh()
      endif
   enddo

   if lGroup
      nLastRow    := nRow - 1
      // end all groups
      for nGrp := nGroups to 1 step -1
         WITH OBJECT ( oRng := oSheet:Range( oRange:Cells( nRow, 1 ), oRange:Cells( nRow, nMergeCols ) ) )
            :MergeCells       := .t.
            :Value            := aGrpFtr[ nGrp ]
            if nGrp > 1
               :InsertIndent( nGrp - 1 )
            endif
         END
         nFont    := Eval( ::aGroups[ nGrp ]:bFootFont )
         if nFont != aFont[ 1 ]
            ::xlSetFont( oRng, ::aFont[ nFont ] )
         endif
         for nCol := 1 to nCols
            oCol  := ::aColumns[ nCol ]
            if oCol:lTotal
               cAdr  := oSheet:Range( oSheet:Cells( aGrpRow[ nGrp ], nCol ), ;
                                      oSheet:Cells( nLastRow, nCol ) ):Address( .f., .f. )
               oSheet:Cells( nRow, nCol ):Formula := "=SUBTOTALES(9;" + cAdr + ")"
               nFont    := Eval( oCol:bTotalFont )
               if nFont != aFont[ nCol ]
                  ::xlSetFont( oSheet:Cells( nRow, nCol ), ::aFont[ nFont ] )
               endif
            endif
         next nCol
         nRow++
      next nGrp

   endif // if lGroup

   if lTotal
      for nCol := 1 to nCols
         oCol     := ::aColumns[ nCol ]
         if oCol:lTotal
            WITH OBJECT oSheet:Cells( nRow, nCol )
               :Formula := "=SUBTOTALES( 9; " + ;
                  oSheet:Range( oSheet:Cells( nFirstRow, nCol ), ;
                  oSheet:Cells( nRow - 1, nCol ) ):Address( .f., .f. ) + ")"
            END
            if ( nFont := Eval( oCol:bTotalFont ) ) != aFont[ nCol ]
               ::xlSetFont( oSheet:Cells( nRow, nCol ), ::aFont[ nFont ] )
            endif
         endif
      next
   endif

   WITH OBJECT oRange:Rows( nRow )
      if lTotal
         WITH OBJECT :Borders( xlTop )
            :LineStyle        := xlContinuous   // 1
            :Weight           := xlThin
         END
      endif
      WITH OBJECT :Borders( xlBottom )
         :LineStyle        := xlContinuous   // 1
         :Weight           := xlMedium
      END
   END

   for nCol := 1 to nCols
      oCol        := ::aColumns[ nCol ]
      if !( oCol:lMemo .or. oCol:lImage )
         oSheet:Columns( nCol ):AutoFit()
      endif
   next

   cAdr  := oSheet:Range( oRange:Rows( nFirstRow ), oRange:Rows( nRow ) ):Address()
   oSheet:PageSetUp:PrintArea := cAdr

   // Write Title
   for nLine := 1 to Len( ::oTitle:aLine )
      WITH OBJECT oRange:Rows( nLine )
         :MergeCells          := .t.
         :Value               := Eval( ::oTitle:aLine[ nLine ] )
         :HorizontalAlignment := { xlLeft, xlRight, xlCenter }[ ::oTitle:aPad[ nLine ] ]
      END
      ::xlSetFont( oRange:Rows( nLine ), ::aFont[ Eval( ::oTitle:aFont[ nLine ] ) ] )
   next

   oExcel:Visible   := .t.

return nil

//----------------------------------------------------------------------------//

METHOD xlSetFont( oRange, oFont ) CLASS TReport

   WITH OBJECT oRange:Font
      :Name       := oFont:cFaceName
      :Size       := oFont:nHeight * 72 / ::nLogPixY
      :Bold       := oFont:lBold
      :Italic     := oFont:lItalic
      if oFont:lUnderLine
         :UnderLine  := xlUnderlineStyleSingle
      endif
   END

return nil

//----------------------------------------------------------------------------//

METHOD xlHeader( oSetUp ) CLASS TReport

   local nLines   := Len( ::oHeader:aLine )
   local nLine, cText
   local aText    := { '', '', '' }

   if nLines == 1 .and. Empty( Eval( ::oHeader:aLine[ 1 ] ) )
      return Self
   endif

   for nLine := 1 to nLines
      aText[ ::oHeader:aPad[ nLine ] ] += xlHeaderLine( ::oHeader:aLine[ nLine ], ;
         ::aFont[ Eval( ::oHeader:aFont[ nLine ] ) ], ::nLogPixY )
   next
   AEval( aText, { |c,i| aText[ i ] := SubStr( c, 2 ) } )

   WITH OBJECT oSetUp
      :LeftHeader    := aText[ RPT_LEFT   ]
      :RightHeader   := aText[ RPT_RIGHT  ]
      :CenterHeader  := aText[ RPT_CENTER ]
   END

return Self

//----------------------------------------------------------------------------//

METHOD xlFooter( oSetUp ) CLASS TReport

   local nLines   := Len( ::oFooter:aLine )
   local nLine, cText
   local aText    := { '', '', '' }

   if nLines == 1 .and. Empty( Eval( ::oFooter:aLine[ 1 ] ) )
      return Self
   endif

   for nLine := 1 to nLines
      aText[ ::oFooter:aPad[ nLine ] ] += xlHeaderLine( ::oFooter:aLine[ nLine ], ;
         ::aFont[ Eval( ::oFooter:aFont[ nLine ] ) ], ::nLogPixY )
   next
   AEval( aText, { |c,i| aText[ i ] := SubStr( c, 2 ) } )

   WITH OBJECT oSetUp
      :LeftFooter    := aText[ RPT_LEFT   ]
      :RightFooter   := aText[ RPT_RIGHT  ]
      :CenterFooter  := aText[ RPT_CENTER ]
   END

return Self

//----------------------------------------------------------------------------//

static function xlHeaderLine( bHeader, oFont, nLogPixY )

   local cStr     := ''
   local cText    := Eval( bHeader )

   if ! Empty( cText )
      cText          := cValToChar( cText )
      cStr           := ""
      if oFont:lBold
         cStr        := "Bold"
      endif
      if oFont:lItalic
         cStr        += " Italic"
      endif
      if Empty( cStr := LTrim( cstr ) )
         cStr        := "Normal"
      endif
      cStr           := Chr( 10 ) + '&"' + oFont:cFaceName + ',' + cStr + '"&'
      cStr           += LTrim( Str( Int( oFont:nHeight * 72 / nLogPixY ) ) )
      cStr           += cText
   endif

return cStr

//----------------------------------------------------------------------------//

 




Hope it helps. Best regards
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: bug FW 13.01 oReport:ToExcel()

Postby nageswaragunupudi » Thu Feb 21, 2013 12:12 am

So it is "=SUBTOTALES(9;" but not "=SUBTOTALES(9,". Please confirm.


can you tell me the result you are getting in cAdr ? Is it in the format "A1;A2" or "A1:A2" ?
Regards

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

Re: bug FW 13.01 oReport:ToExcel()

Postby lucasdebeltran » Thu Feb 21, 2013 11:01 am

Yes, it is "=SUBTOTALES( 9; .

In spanish, uses ;.

My method posted works fine with Excel in Spanish.

Thank you very much.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: bug FW 13.01 oReport:ToExcel()

Postby lucasdebeltran » Thu Mar 21, 2013 7:52 pm

Hello,

Any update?.

Thanks.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: bug FW 13.01 oReport:ToExcel()

Postby nageswaragunupudi » Fri Mar 22, 2013 5:37 am

Version 13.03 ( to be released soon ) uses this formula for Spanish installation of Excel

"=SUBTOTALES( 9;A1:A9) // if the range is A1:A9

Hope this is correct.
Regards

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

Re: bug FW 13.01 oReport:ToExcel()

Postby lucasdebeltran » Fri Mar 22, 2013 8:25 am

Hello,

I posted above my code.

If you indicate me an .exe to test I can do the test before you reléase FW 13.03.

Thank you very much.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: bug FW 13.01 oReport:ToExcel()

Postby lucasdebeltran » Mon Mar 25, 2013 9:09 am

Up!.

Thanks
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests