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
#include "fivewin.ch"
REQUEST DBFCDX
function wwonders()
local cXlsx
USE C:\FWH\SAMPLES\WWONDERS VIA "DBFCDX"
cXlsx := DBF2XLSX()
ShellExecute( 0, "Open", cXlsx )
return nil
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
#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
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.
#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
#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
oXlsx:CreateFrom() // uses current alias
oXlsx:CreateFrom( oRs )
#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
REQUEST XLXLIB
echo $(FWDIR)\lib\xlsxlibhbmsvc.lib >> msvc.tmp
Master.obj : error LNK2001: unresolved external symbol _HB_FUN_XLXLIB
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 28 guests