Page 1 of 1

Strange result with Xbrowse and oBrw:toexcel

PostPosted: Tue Jul 06, 2021 9:39 pm
by Marc Venken
Using this code :

@ 880,400 BTNBMP oBtn1 OF oDlg SIZE 200, 30 NOBORDER PROMPT "Prijswijzigingen naar Exel" 2007 TOOLTIP "Tool1" ACTION exportdata(obrw4)

Code: Select all  Expand view
function exportdata(oBrw)
  select nofoto
  set filter to nofoto->selected
  oBrw:refresh()
  oBrw:ToExcel( NIL,NIL, { oBrw:oCol( "Id" ), oBrw:oCol( "Brandid" ), oBrw:oCol( "Benaming" ) } )
  //METHOD ToExcel( bProgress, nGroupBy, aCols, lShow, cPDF, bPrePDF ) CLASS TXBrowse
  set filter to
  oBrw:refresh()
return
 


I get a excel with the 3 columns = OK, but i also get 3 group headers (Webshop, Maveco, Brand)
These groupheaders are coded in xbrowse setup :

:SetGroupHeader( "Webshop", oBrw4:oCol("Shopprijs"):nCreationOrder, oBrw4:oCol("Shopmarge"):nCreationOrder )
:SetGroupHeader( "Brand", oBrw4:oCol("Bruto"):nCreationOrder, oBrw4:oCol("OudBruto"):nCreationOrder )
:SetGroupHeader( "Maveco", oBrw4:oCol("Prijs_1"):nCreationOrder, oBrw4:oCol("Marge"):nCreationOrder )

Is there a setting that ToExcel is not showing them ? I'm not sure of the options for nGroupBy values...

result of excel...

Id BrandId Benaming Webshop Maveco Brand (

1042PB LB_1042PB TROUSER 1042PB GREY 44
1043PB LB_1043PB TROUSER 1043PB WHITE 44
1052PB LB_1052PB TROUSER 1052PB GREY 44
1053PB LB_1053PB SHORTS 1053PB KHAKI 44

Re: Strange result with Xbrowse and oBrw:toexcel

PostPosted: Fri Jul 09, 2021 11:56 am
by ukoenig
Marc,

groupheaders
Is there a setting that ToExcel is not showing them ?


there is a switch

add to the button-action or function

button

ACTION ( oBrw4:lGrpHeader := .F. , ;
exportdata(obrw4), ;
oBrw:lGrpHeader := .T. )

or inside Your function

...
oBrw:lGrpHeader := .F. , ; // oBrw:SetGroupHeader() OFF
oBrw:ToExcel( NIL,NIL, { oBrw:oCol( "Id" ), oBrw:oCol( "Brandid" ), oBrw:oCol( "Benaming" ) } )
oBrw:lGrpHeader := .T. ) // oBrw:SetGroupHeader() ON
...

regards
Uwe :D

Re: Strange result with Xbrowse and oBrw:toexcel

PostPosted: Fri Jul 09, 2021 12:44 pm
by Marc Venken
Thanks Uwe...