Export listbox to image


I remember having read something about converting or capturing a listbox content directly into a picture in v17.

But I can’t find it in the various documentation sources about 4D.

Does that listbox-export-to-picture thing rings a bell in the forum’s collective memory?

Thanks for your help and replies.


Export of a listbox array


<code 4D>
// La méthode 4DLB_vers_txt copie chaque ligne d’une listbox tableau
// Le contenu est retourné dans une variable texte
// #SYNTAX: $_Txt:=4DLB_vers_txt({$T_Col_sepa;$T_Row_sepa})
// Aucun
// $0 Long : code d’erreur. 1 = OK
// $1 Pointeur : la listbox
// $2 Texte : optionel, séparateur de colonne (def. tab)
// $3 Texte : optionel, séparateur de ligne (def. cr)

// #DATE CREATION: 11/10/2014 #AUTHOR: Bertrand SOUBEYRAND soub@soub.org
// #DATE MODIFICATION: 00/00/0000
// #NOTE:


C_TEXT($0;$T_Data) // tabbed listbox

LBaR_Get_PTR_Listbox (->$P_LB)

$T_Row_sepa:=Char(Carriage return)
If (Count parameters>0)

C_TEXT($1;$T_Col_sepa)  // Column separator. Default  Tab
C_TEXT($2;$T_Row_sepa)  // Row separator. default CR


End if

ARRAY TEXT($rT_Col_names;0)
ARRAY TEXT($rT_Header_names;0)
ARRAY POINTER($rP_Col_var;0)
ARRAY POINTER($rP_Header_var;0)
ARRAY BOOLEAN($rB_Col_visibles;0)
LISTBOX GET ARRAYS($P_LB->;$rT_Col_names;$rT_Header_names;$rP_Col_var;$rP_Header_var;$rB_Col_visibles;$rP_Style)

$L_Count_rows:=Size of array($rP_Col_var{1}->)
$L_Count_cols:=Size of array($rT_Col_names)

$P_Hidden:=$rP_Style{4} // le tableau associé pour cacher les lignes

// 17/01/15 ajout entête LB
For ($j;1;$L_Count_cols)

If ($rB_Col_visibles{$j}=True)
	If ($j#1)
	End if 
	$T_Data:=$T_Data+OBJECT Get title($rP_Header_var{$j}->)
End if 
If ($j=$L_Count_cols)
End if 

End for

For ($i;1;$L_Count_rows)

If ($P_LB->{$i}) & ($P_Hidden->{$i}#lk hide)  // si c'est une ligne sélectionnée et non cachée
	For ($j;1;$L_Count_cols)
		If ($rB_Col_visibles{$j}=True)
			If ($j#1)
			End if 
			$T_Replace:=Replace string($T_Replace;"\r";" ¶ ")
			$T_Replace:=Replace string($T_Replace;"\t";" → ")
		End if 
	End for 
	If ($i<$L_Count_rows)
	End if 
End if 

End for


// EOM

</code 4D>

the pointer to the columns $rP_Col_var dos not work with a listbox of type “collection or entity selection”

Hi Olivier,
I’m wondering why a picture? Or what for, if you prefer…

I was thinking a bout FORM SCREENSHOT, but I don’t think you’re in for that :wink:

Hi Arnaud,

I will be showing a dashboard in which is implemented as a dynamic listbox. I’d like to have that dashboard available inside a generated report without having to recode it into e.g. SVG or 4WP.

I completely overlooked Form screenshot in the doc, thanks for that… But why the wink?


It depend of what type of listbox :?: In v18, you will be able to use 4D View Pro and commands like VP SET VALUES and VP Convert to picture…


I completely overlooked Form screenshot in the doc, thanks for
that… But why the wink?
'cause I thought you could not miss it!

Hi Olivier,

Maybe you are remembering https://blog.4d.com/4d-view-pro-svg-conversion/this> from a few months ago?

Hi Adam,

Thanks a lot! That was it!


Yes, thanks too, very good to know :slight_smile:
Speaking about getting a picture of a 4d view pro document, in 4d write we could get parts of the document as picture with WR Area to picture. Is there something similar in 4d write pro?

I don’t use 4D Write Pro so I’m not really sure.

But from what I understand you can export to HTML, so from there you could try converting the whole document using Chrome headless (see https://stackoverflow.com/questions/10721884/render-html-to-an-imagehere>). Not great, but might work.