Xlsxlibhb_ver2

Xlsxlibhb_ver2

Postby arturo tamayo » Tue Oct 03, 2023 8:01 pm

Dear All,

Here I leave the sources of our contribution for harbor and xharbour of the complete functions of John McNamara for the libxlsxwriter,

enjoy it

To download the complete library from https://www.mediafire.com/file/8bn1bbcx ... 2.zip/file

Greetings
Arturo Tamayo Daza
arturo tamayo
 
Posts: 36
Joined: Fri Jan 02, 2009 3:12 pm

Re: Xlsxlibhb_ver2

Postby richard-service » Wed Oct 04, 2023 3:22 am

arturo tamayo wrote:Dear All,

Here I leave the sources of our contribution for harbor and xharbour of the complete functions of John McNamara for the libxlsxwriter,

enjoy it

To download the complete library from https://www.mediafire.com/file/8bn1bbcx ... 2.zip/file

Greetings
Arturo Tamayo Daza


Thank you so much.
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 804
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: Xlsxlibhb_ver2

Postby Antonio Linares » Wed Oct 04, 2023 4:07 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Xlsxlibhb_ver2

Postby nageswaragunupudi » Thu Oct 05, 2023 12:01 am

Many thanks to the authors for making this Great Library available to our Harbour community.

Thank you Mr. John McNamara and Mr. Arturo Tamayo Daza
Regards

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

Re: Xlsxlibhb_ver2

Postby RAMESHBABU » Thu Oct 05, 2023 1:11 am

Hi,

When I am trying to use the XlsxlibHb with xHarbour,
I am getting the following error.

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ FiveWin for xHarbour 21.04 - Apr. 2021 Harbour development power ³Ü
³ (c) FiveTech 1993-2021 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8/10 ³Û
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
Compiling...
xHarbour 1.2.3 Intl. (SimpLex) (Build 20201212)
Copyright 1999-2020, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'chart_data_table.prg' and generating preprocessed output to 'chart_data_table.ppo'...

Lines 120, Functions/Procedures 2, pCodes 335
Embarcadero C++ 7.00 for Win32 Copyright (c) 1993-2015 Embarcadero Technologies, Inc.
chart_data_table.c:
Turbo Incremental Link 6.70 Copyright (c) 1997-2014 Embarcadero Technologies, Inc.
Error: Unresolved external '_hb_parvptr' referenced from C:\FWH\LIB\XLSXLIBHB.LIB|XlxsFunc
Error: Unable to perform link
* Linking errors *

Will this library work with only Harbour or xHarbour too ?

-Ramesh Babu
User avatar
RAMESHBABU
 
Posts: 625
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Re: Xlsxlibhb_ver2

Postby nageswaragunupudi » Thu Oct 05, 2023 10:07 am

While working with this library I am learning a lot while enjoying it.
Till now I have used only a very few features of the library and there is a lot more to explore.

Exporting CUSTOMER.DBF to CUSTOMER.XLSX
Image

Exporting WWONDERS.DBF to WWONDERS.XLSX with IMAGES in the Memo Fields:
Image
Regards

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

Re: Xlsxlibhb_ver2

Postby nageswaragunupudi » Thu Oct 05, 2023 10:12 am

Main program:
Code: Select all  Expand view  RUN
#include "fivewin.ch"

REQUEST DBFCDX

function wwonders()

   local cXlsx

   USE C:\FWH\SAMPLES\WWONDERS VIA "DBFCDX"
   cXlsx    := DBF2XLSX()
   ShellExecute( 0, "Open", cXlsx )

return nil
 


Exporting to xlsx is easy using this new function:
Code: Select all  Expand view  RUN
function DBF2XLSX( cFileXlsx )

   local oBook, oSheet
   local aStruct, bRow, nRow

   if Empty( Alias() )
      return nil
   endif

   DEFAULT cFileXlsx := cFileSetExt( DbInfo( DBI_FULLPATH ), "xlsx" )

   oBook    := TWorkBook():New( cFileXlsx )
   if oBook == nil
      ? "Can not create " + cFileXlsx
      return nil
   endif

   GO TOP
   aStruct  := DBSTRUCT()
   AEval( aStruct, { |a,i| If( a[ 2 ] == "M" .and. IsBinaryData( FieldGet( i ) ), a[ 2 ] := "m", nil ) } )
   bRow     := "{||{" + FW_ArrayAsList( ArrTranspose( aStruct )[ 1 ] ) + "}}"
   bRow     := &( bRow )

   oSheet   := oBook:AddSheet()
   nRow  := oSheet:SetStruct( aStruct )
   DBEVAL( { || nRow := oSheet:SayRow( nRow, Eval( bRow ) ) } )

   oBook:Close()

   ? "Exported to " + cFileXlsx

return cFileXlsx
 

In turn this function uses a small class I started making now. Right now, this class uses minimal features of this library
Regards

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

Re: Xlsxlibhb_ver2

Postby Antonio Linares » Thu Oct 05, 2023 10:24 am

Dear Ramesh,

Please add this code to the bottom of your main PRG and please let me know if it solves that unresolved external for you using xHarbour

many thanks for your feedback
Code: Select all  Expand view  RUN
#pragma BEGINDUMP

#include <hbapi.h>

#ifdef __XHARBOUR__

#include <stdarg.h>

void * hb_parvptr( int iParam, ... )
{
    void * result;
    va_list args;
    va_start( args, iParam );
    result = hb_parptr( iParam, args );
    va_end( args );

    return result;
}

#endif

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Xlsxlibhb_ver2

Postby RAMESHBABU » Fri Oct 06, 2023 1:36 am

Dear Antonio,

Wonderful. It worked !!.

That is Antonio and THE MASTER.

As told by Mr.Nageswara Rao

While working with this library I am learning a lot while enjoying it.
Till now I have used only a very few features of the library and there is a lot more to explore.


There is a lot to learn from this Library.

-Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 625
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Re: Xlsxlibhb_ver2

Postby nageswaragunupudi » Sun Oct 15, 2023 3:11 pm

FWH will include an interface class to this library
If this library is downloaded and linked with FWH we can use the class to use the lib with much ease.

Fonts and Images

Image

Code: Select all  Expand view  RUN
#include "fivewin.ch"

REQUEST FWXLSXLIB

function Main()

   local cFile, oXlsx, oFormat

   cFile    := "testfont.xlsx"
   oXlsx    := XlsxLibObj( cFile )

   WITH OBJECT oXlsx

      WITH OBJECT( oFormat := :Format() )
         :SetFont( "IMPACT", 50, NARGB(0,CLR_HRED), "BOLD" )
         :SetColor( nil, NARGB( CLR_YELLOW ) )
         :FontRotate( 90 )
         :SetAlign( 2, 10 )
      END

      :MergeRange( 0,0,15,0, "MERGED", oFormat )
      :SetColumnSize( 1, 1, 40 )

      WITH OBJECT( oFormat := :Format() )
         :SetFont( "Times New Roman", 20, 0, "BOLD" )
      END

      :Say( "B1", "Times New Roman", oFormat )
      :Say( 1, 1, "äöüÄÖÜ",  :Format():SetFont( "tahoma", 16, 0xff0000 ) )
      :B3    := "THIRD ROW"
      WITH OBJECT ( oFormat := :Format() )
         :NumFormat( 4 )
         :SetFont( "Lucida Console", 14, 0x0000ff, "bold" )
      END
      :Say( 4, 1, 3456789.2, oFormat )

      // Image
      :aImageSize( 1000, 700 )
      :B17 := MEMOREAD( "\fwh\bitmaps\sea.bmp" )

      :Close()

   END

   ShellExecute( 0, "Open", cFile )

return nil
 
Regards

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

Re: Xlsxlibhb_ver2

Postby nageswaragunupudi » Thu Oct 19, 2023 4:04 am

This example demonstrates:

1. Image Brush
2. Sheet name customized
3. Group Headers
4. Freeze Header Rows
5. Hide Zero values
6. Footer row with aggregage formulae

Image

Exporting tables is very simple
Code: Select all  Expand view  RUN
#include "fivewin.ch"

function Main()

   local oXlsx, aStruct, aGroup, aFooter, bRow, nRow

   // Prepare DBF
   USE CUSTOMER
   aStruct  := DbStruct()
   aGroup   := { { 2, 3, "NAME" }, { 4,7,"ADDRESS" }, { 9, 10, "PERSONAL" } }
   aFooter  := { ,"TOTALS",,,,,,,,"=AVERAGE(range)","=SUM(range)", }
   bRow     := "{||{" + FW_ArrayAsList( ArrTranspose( aStruct )[ 1 ] ) + "}}"
   bRow     := &( bRow )

   // Write to xlsx
   if ( oXlsx := XlsxLibObj( "customer.xlsx", "customer" ) ) != nil
      WITH OBJECT oXlsx
         nRow  := :SetStruct( aStruct,,aGroup )
         DBEVAL( { || nRow := :SayRow( nRow, Eval( bRow ) ) } )
         :SetFooter( aFooter )
         :SetBackGround( "\fwh\bitmaps\backgrnd\paper2.bmp" )
         :HideZero()
         //
         :Close()
         ? "Created customer.xlsx"
         ShellExecute( 0, "Open", "customer.xlsx" )
      END
   else
      ? "Can not create xlsx"
   endif

return nil
 
Regards

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

Re: Xlsxlibhb_ver2

Postby nageswaragunupudi » Thu Oct 19, 2023 5:43 am

One line code for no frills export of DBF or other tables
Code: Select all  Expand view  RUN
oXlsx:CreateFrom() // uses current alias


for other tables:
Code: Select all  Expand view  RUN
oXlsx:CreateFrom( oRs )
Regards

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

Re: Xlsxlibhb_ver2

Postby nageswaragunupudi » Thu Oct 19, 2023 6:00 am

Exporting multiple tables to different Sheets/Tabs of one single ExcelBook:
Code: Select all  Expand view  RUN
#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local oXlsx

   USE STATES SHARED NEW
   USE WWONDERS SHARED NEW VIA "DBFCDX"
   USE CUSTOMER SHARED NEW

   if ( oXlsx := XlsxLibObj( "mydbfs.xlsx", Alias() ) ) != nil
      WITH OBJECT oXlsx
         CUSTOMER->( :CreateFrom() )
         STATES->(   :AddSheet( Alias() ):CreateFrom() )
         WWONDERS->( :AddSheet( Alias() ):CreateFrom() )
         :Close()
      END
      ? "Created mydbfs.xlsx"
      ShellExecute( 0, "Open", "mydbfs.xlsx" )
   else
      ? "can not create xlsx"
   endif

   CLOSE DATA

return nil
 


Image
Regards

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

Re: Xlsxlibhb_ver2

Postby Horizon » Sat Nov 04, 2023 12:00 pm

Hi Mr. Rao,

To use this library in fwh 23.10.

I have add this line to my main application.
Code: Select all  Expand view  RUN
REQUEST XLXLIB


I have add my this line to my makefile.
Code: Select all  Expand view  RUN
 echo $(FWDIR)\lib\xlsxlibhbmsvc.lib >> msvc.tmp  
 


I have compiled my application. There is an error like this.
Code: Select all  Expand view  RUN
Master.obj : error LNK2001: unresolved external symbol _HB_FUN_XLXLIB


What else do I need to do?
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: Xlsxlibhb_ver2

Postby nageswaragunupudi » Sat Nov 04, 2023 12:58 pm

Please use

REQUEST XLSXLIB

Sorry for the spelling mistake in the whatsnew.txt
Regards

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 31 guests