Export listbox to image

Hello,

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.

Olivier

Export of a listbox array

https://forums.4d.com/4DBB_Main/x_User/3906/files/28090829.zip

<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})
// #PARAMETERS:
// 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:

// #HEADER VERSION: 2

C_TEXT($0;$T_Data) // tabbed listbox
$T_Data:=""

C_POINTER($P_LB)
LBaR_Get_PTR_Listbox (->$P_LB)

C_TEXT($T_Col_sepa;$T_Row_sepa)
$T_Col_sepa:=Char(Tab)
$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

$T_Col_sepa:=$1
$T_Row_sepa:=$2

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)
ARRAY POINTER($rP_Style;0)
LISTBOX GET ARRAYS($P_LB->;$rT_Col_names;$rT_Header_names;$rP_Col_var;$rP_Header_var;$rB_Col_visibles;$rP_Style)

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

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

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

If ($rB_Col_visibles{$j}=True)
	
	If ($j#1)
		$T_Data:=$T_Data+$T_Col_sepa
	End if 
	
	$T_Data:=$T_Data+OBJECT Get title($rP_Header_var{$j}->)
End if 
If ($j=$L_Count_cols)
	$T_Data:=$T_Data+$T_Row_sepa
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
	
	C_LONGINT($j)
	For ($j;1;$L_Count_cols)
		
		If ($rB_Col_visibles{$j}=True)
			If ($j#1)
				$T_Data:=$T_Data+$T_Col_sepa
			End if 
			
			C_TEXT($T_Replace)
			$T_Replace:=String($rP_Col_var{$j}->{$i})
			$T_Replace:=Replace string($T_Replace;"\r";" ¶ ")
			$T_Replace:=Replace string($T_Replace;"\t";" → ")
			$T_Data:=$T_Data+$T_Replace
		End if 
		
	End for 
	
	If ($i<$L_Count_rows)
		$T_Data:=$T_Data+$T_Row_sepa
	End if 
	
End if 

End for

$0:=$T_Data

// 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…

PS
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?

Olivier

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…

: Olivier RANDRIAMANANA

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!

Olivier

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.